Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Ilogic code to access "ModelingSettings.SolidBodyNamePrefix() As String"

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
dclunie
617 Views, 7 Replies

Ilogic code to access "ModelingSettings.SolidBodyNamePrefix() As String"

Hi

 

I am after help we are attempting to access the file naming  prefix in documents settings but i am unable to start code or find away to get where i need.

 

We have a multi solid bodie part that changes on via suppression to different styles of profile we then need the file naming prefix to chage depending on what key have selected .

 

ie Parameter = Style with 4 Multi selctions 1,2,3,4

depending on selection picked we then need to change the Solid Bodies Prefix in document settings..

 

Example :: If style = 1 then Solid Bodies Prefix = Dave

 

Any Help would be appreciated

 

D Clunie

 

 

 

 

 

 

 

7 REPLIES 7
Message 2 of 8
Curtis_Waguespack
in reply to: dclunie

Hi dclunie,

 

Here's an example of renaming solid bodies using a prefix, although it uses a slightly different method:

http://inventortrenches.blogspot.com/2012/02/ilogic-to-rename-all-solid-bodies.html

 

It's not exaactly what you were after, but might help you get there.

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

Message 3 of 8
dclunie
in reply to: dclunie

Hi Curtis

 

We have this code from your website but can this be manipulated to do what i need

as we want the prefix to be set before we start to make solids

 

Select key 1 that Equals sandcladding then prefix is set to Sandcladding

Select key 2 that Equals Cellufoam then prefix is set to Cellufoam

Select key 3 that Equals Timberclad then prefix is set to Timberclad

 

the idea being that we can have solid bodies named as we create and using view rep rule to isolate by name.

 

Hope this makes sense

 

d clunie

 

 

Message 4 of 8
Curtis_Waguespack
in reply to: dclunie

Hi dclunie,

 

Here's a quick snippet that will set the prefix from a list.

I've attached this as a *.txt file as well , in case the line wrap causes an issue.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

Dim MyArrayList As New ArrayList
MyArrayList.add("Sandcladding")
MyArrayList.add("Cellufoam")
MyArrayList.add("Timberclad")

'get input from user
sPrefix = InputListBox("Select an option: ", MyArrayList, MyArrayList.Item(0), "iLogic", "List of Options")

'Define the open document
Dim openDoc As Document
openDoc = ThisDoc.Document
'set solid body prefix
openDoc.ModelingSettings.SolidBodyNamePrefix = sPrefix

 

Message 5 of 8
JBerns
in reply to: dclunie

@Curtis_Waguespack,

 

I realize this is an old post, but the topic is so closely related to my question.

 

Does the Inventor API allow access to settings in the Make Components Dialog?

(Tools > Document Settings > Modeling tab > Make Components Dialog)

2023-09-05_15-23-23.png

 

I haved searched the forums and the Inventor API Help, but I cannot find any access.

 

Please let me know if I should start a new topic post.

 

 

Regards,

Jerry

-----------------------------------------------------------------------------------------
CAD Administrator
Using Inventor 2022
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
Message 6 of 8
Curtis_Waguespack
in reply to: dclunie

Hi @JBerns 

 

I'm all but certain the answer is still no, but someone can correct me if I am wrong.

 

See this link for a code example to do this programmatically with the derive part functions:

https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/ilogic-quot-make-components-quot/td-...

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

Message 7 of 8
JBerns
in reply to: dclunie

Thanks, Curtis.

I will try that code tomorrow.

Will need to add this request to the IdeaStation.

 

Regards,

Jerry

-----------------------------------------------------------------------------------------
CAD Administrator
Using Inventor 2022
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
Message 8 of 8
JBerns
in reply to: dclunie

@Curtis_Waguespack,

 

Thanks again for the code. We may be able to leverage this tool.

 

I was able to get this far with an iLogic rule to access the Make Components dialog:

 

AddReference "System.Windows.Forms"
Imports System.Windows.Forms

' Declare a command manager
Dim oCommandMgr As CommandManager 
oCommandMgr = ThisApplication.CommandManager 
Dim oControlDef As ControlDefinition 
oControlDef = oCommandMgr.ControlDefinitions.Item("AppDocumentSettingsCmd")
' Execute without pausing
Call oControlDef.Execute2(False)
' Opens to Make Components Dialog
SendKeys.SendWait("{TAB 5}{RIGHT 3}{TAB 15}{ENTER}")
' wait for second dialog to open
'Threading.Thread.Sleep(500) ' 500 milliseconds = 0.5 seconds
' Perform the event
ThisApplication.UserInterfaceManager.DoEvents()

 

 

It's interesting how different the behavior is between the various Inventor dialogs. See iLogic rules in attached part.

-----------------------------------------------------------------------------------------
CAD Administrator
Using Inventor 2022
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional

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

Post to forums  

Autodesk Design & Make Report