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: 

Help Solving Place iLogic Component Naming Problem

4 REPLIES 4
Reply
Message 1 of 5
MRanda
1337 Views, 4 Replies

Help Solving Place iLogic Component Naming Problem

Hello folks, I have a problem that may be of interest to quite a few others. The problem is that when you place an iLogic Assembly –the program appends all of the file names with a dash and a number –which solves the duplicate file name problem, but will destroy any code used at the assembly level to configure the parts and subassemblies contained within.

What I am looking for is code that will return the names of the components in an assembly so that I can assign them to variables. For instance, a part named Bottom.ipt would be assigned a variable name of Bottom, and any part name that starts with “Bottom” –no matter what is appended to it, would be assigned to the variable in that particular instance of the assembly i.e. Bottom = “Bottom-08.ipt”. This way the code would never brake as it does now due to the auto renaming.

I am also looking for a way to mark some of the parts and sub assemblies as purchased components that are not renamed, but just instanced as normally placed parts are, but that can wait.

Any help would be greatly appreciated.

Intel i7-6700K Liquid Cooled CPU
MSI GTX GeForce 1080 AERO 8GB OC Graphics
32 Gigs DDR 4 Ram
500 GB SSD OS Drive
4TB SSHD File Server Drive
Windows 10 Pro
Applied Design Intelligence
http://applieddesignintelligence.com/
4 REPLIES 4
Message 2 of 5
theo.bot
in reply to: MRanda

Dear Mark,

You need to rename your browser nodes before writing a code. That's one of the first must do for ilogic.
If you rename the browser node, this override remains even after the copy moment.
For example: when you place a part, the browser nane is the "filename+:1". Normaly when you use place ilogic the files are copied and get new filenames. The displyname in the browser will be updated to the new filename (newfilename:1). But by renaming the display name you can avoid this behavior. And the display name stays the same even after the copy moments.

Kind regards,

Theo Bot
Message 3 of 5
MRanda
in reply to: theo.bot

Thanks much theo. bot! I had come up with renaming the browser nodes via iLogic code upon placement. It does the same thing but in a very round-about way!  It never even crossed my mind that it was as simple as changing the nodes right from the get-go. 

 

Thanks again theo.bot!

 

Mark Randa

OpenDesignProject

Intel i7-6700K Liquid Cooled CPU
MSI GTX GeForce 1080 AERO 8GB OC Graphics
32 Gigs DDR 4 Ram
500 GB SSD OS Drive
4TB SSHD File Server Drive
Windows 10 Pro
Applied Design Intelligence
http://applieddesignintelligence.com/
Message 4 of 5
ferhat
in reply to: MRanda

Hi MRanda

How did you solve this problem.Do I need to write a code for it? .Could you please tell in detail?

 

Kind regards,

 


@MRanda wrote:

Hello folks, I have a problem that may be of interest to quite a few others. The problem is that when you place an iLogic Assembly –the program appends all of the file names with a dash and a number –which solves the duplicate file name problem, but will destroy any code used at the assembly level to configure the parts and subassemblies contained within.

What I am looking for is code that will return the names of the components in an assembly so that I can assign them to variables. For instance, a part named Bottom.ipt would be assigned a variable name of Bottom, and any part name that starts with “Bottom” –no matter what is appended to it, would be assigned to the variable in that particular instance of the assembly i.e. Bottom = “Bottom-08.ipt”. This way the code would never brake as it does now due to the auto renaming.

I am also looking for a way to mark some of the parts and sub assemblies as purchased components that are not renamed, but just instanced as normally placed parts are, but that can wait.

Any help would be greatly appreciated.




Ferhat BALTACI

Desita Yazılım
www.desita.com.tr
Message 5 of 5
Paul__H
in reply to: MRanda

Hi MRanda

 

Please find the attached code which renames the Browser nodes, i use this on every iLogic assembly i create.

The credit for the original rule needs to go to Cadline.

'Start of iLogic code

' This rule will 'Stabilise' the first level assembly browser nodes by renaming them and then
' renaming back to the previous node name. It can be run at any point in the design process,
' before any copying of assemblies is done, and the post-copied assembly browser nodes will remain
' unchanged - (allowing iLogic rules to function)
' Check this file is an assembly
Checkdoc = ThisDoc.ModelDocument
If Checkdoc.DocumentType <> kAssemblyDocumentObject Then
MessageBox.Show("This rule can only be run in an assembly file!", "iLogic")
Return
End If
Dim doc As Document
Dim oDef As AssemblyComponentDefinition = Checkdoc.ComponentDefinition
Dim oCompOcc As Inventor.ComponentOccurrence
Count = 1
For Each oCompOcc In oDef.Occurrences
If oCompOcc.Suppressed = False Then
doc = oCompOcc.Definition.Document
' Store current component name
CurrentName = oCompOcc.Name
' Set a random name for occurence
oCompOcc.Name = Count & "Pauls_iLogic"
' Update
InventorVb.DocumentUpdate()
' Reset component name to previous name
oCompOcc.Name = CurrentName
End If
Count = Count + 1
Next

 

 

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

Post to forums  

Autodesk Design & Make Report