Set Appearance for New part

Set Appearance for New part

Anonymous
Not applicable
863 Views
3 Replies
Message 1 of 4

Set Appearance for New part

Anonymous
Not applicable

What is the coding for setting the appearance of the current part document? I have a userform where the user will select the appearance from a combobox. Having troubles understanding how to apply it once the user makes a selection.

0 Likes
864 Views
3 Replies
Replies (3)
Message 2 of 4

MechMachineMan
Advisor
Advisor

Searching existing documentation is a pretty good start...

 

https://knowledge.autodesk.com/support/inventor-products/learn-explore/caas/CloudHelp/cloudhelp/2015...


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 3 of 4

Anonymous
Not applicable

Thanks for the info but I need this in VBA format. I was thinking it would be easy as:

 

 Sub main()

Dim oPDoc as PartDocument

Set oPDoc = ThisApplication.ActiveDocument

oPDoc.ActiveAppearance = "My Appearance" 'this is where I need help. how do you set the appearance using the name?

End sub 

 

the syntax I know is wrong for setting the appearance. What is the correct syntax? (assuming appearance exists and does not need to be created, although that bit of code would be nice too)

0 Likes
Message 4 of 4

MechMachineMan
Advisor
Advisor

Again, searching for help is step 1.

 

http://help.autodesk.com/view/INVNTOR/2018/ENU/?guid=GUID-7AF9FEE7-D326-49C8-87CC-D5498EA49194

 

As SHOWN in the link (ie; ONLINE HELP), the ActiveAppearance property is of the ASSET type, not a STRING like you are attempting. If you read further into the asset object type, or even through the parents of appearance/asset, you should be able to find out how to access the appearance asset by name (even it it means iterating through a large collection and checking for an equality based off of a name property or something similar).


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes