-1

How do I create a section plane, section slice, or section box? Any code would be good, but I'm using VBA.

I think I'm not using the right objects/methods and don't have a good grasp of OOP.

I'm trying to create a macro that lets the user enter different coordinate systems for creating sections. I have the coordinate conversions knocked out, but I'm struggling with making the sections in CATIA V5.

Community
  • 1
  • 1

1 Answers1

0

Hi i would suggest you to record your actions in Catia to macro. Then look what was recorded and learn from it. If it's not recorded then you have no option to automate it (if you want to avoid CAA Api)

EDIT

Well I give it some other though and test this myself. It indeed doesn't show up in the recorded macro which in most cases (99%) shows that it's not available but in this case the Objects truly exists in API. But the access to them is rather different than normal objects (like parameters, relations, constrains and so on)

You have to get the collection of Sections for product in a different way like so:

Sub CATMain()
    
   Dim Prod As ProductDocument
   Set Prod = CATIA.ActiveDocument
        
   Dim Sect As Sections 
   Set Sect = Prod.Product.GetTechnologicalObject("Sections") 'This is how you get the section collections a can do something with them
                
End Sub

Locals in VBA Editor in CATIA

Tree sections in catia

Then after all you can come up with something. I have to apologize that i did not make better effort to test this.

DJakub
  • 41
  • 5
  • Thanks! I tried the recording thing to see what CATIA does and there was nothing there. What's CAA API? Even if it's a pain could I automate sectioning with that? – Darius McAdam Jun 30 '21 at 00:24
  • Also, I'm sure you're right about not being able to automate the task if CATIA can't record it. However, I did find a section object online and it has a method for setting the position of the section. Here's the link to the object page http://catiadoc.free.fr/online/interfaces/interface_Section.htm – Darius McAdam Jun 30 '21 at 00:26
  • CAA Api is using C++ libraries directly from Catia. To compile it and use it you need pretty expensive license and the customer who wants to use it need to also have this expensive license. For Example Validat or Qchecker are such things. You practically become dassault software partner. Anyway its a big deal to make things with CAA api. What are most people using is Automation trough COM API which is stripped and have limited functionality but still pretty usefull. – DJakub Jun 30 '21 at 09:33
  • If your actions are not recorded in the macro then sadly there is no way trough the free API. – DJakub Jun 30 '21 at 09:37
  • Dang, thanks for the info! If you didn't say that I would have been banging my head against the wall for hours trying to figure this out – Darius McAdam Jul 01 '21 at 17:03