Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How create a Flat Pattern from VBA code?

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
ladimirabdala
3339 Views, 4 Replies

How create a Flat Pattern from VBA code?

Hello every body. What's up?

 

I need a code to generate the Flat Pattern in VBA.

I made an app who sets the specific material and I would like to unfold the folded part at the same time.

 

I tried this code, but not works:

 

  Dim partDoc As PartDocument
  Dim sheetMetalDef As SheetMetalComponentDefinition
  If (Not sheetMetalDef.HasFlatPattern()) Then
   sheetMetalDef.Unfold
  End If

 


 

Ladimir Abdala

ThyssenKrupp Elevadores

Brazil

Windows 7 Professional 64Bits

Inventor 2011 Pro

 

 

4 REPLIES 4
Message 2 of 5
skyngu
in reply to: ladimirabdala

the code is in the vba help .

Autodesk Inventor Professional 2019
Message 3 of 5
ladimirabdala
in reply to: skyngu

If you found, please past clip here. Because I searched it, but all codes I tried not work.

 

The "action" of the "Create Flat Pattern" button is what I want.

 

Message 4 of 5

Unsure if this is your problem, but i had to ensure that the part was a sheetmetal part.

So i use the control definition item (like pushing the convert to sheet metal button)

then my part will unfold.

 

Dim oPartDoc As PartDocument

Set oPartDoc = ThisApplication.ActiveDocument

Dim oDef As ControlDefinition

Set oDef = ThisApplication.CommandManager.ControlDefinitions.Item("PartConvertToSheetMetalCmd")

oDef.Execute

Dim oCompDef As SheetMetalComponentDefinition

Set oCompDef = oPartDoc.ComponentDefinition

oCompDef.Unfold

 

I also use this one to switch back to the part view afterwards.

 

Set oDef = ThisApplication.CommandManager.ControlDefinitions.Item("PartSwitchRepresentationCmd")

oDef.Execute

 

Hope this helps you.

 

Dean.

Message 5 of 5

Great Dean!!!

 

Your code works as well.

It is exactly I want.

 

Best regards from Brazil.

Thank you very much.

 

 

Ladimir Abdala

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report