iLogic Design Copy assembly part names change disrupting rule

iLogic Design Copy assembly part names change disrupting rule

Anonymous
Not applicable
2,401 Views
11 Replies
Message 1 of 12

iLogic Design Copy assembly part names change disrupting rule

Anonymous
Not applicable

Dear Cad community,

 

currently im trying to make a rule driven assembly which i want to copy (multiple times in 1 project) using the ilogic design copy.

but when i copy the assembly and add a prefix (need to ad one seeing there will be more than one of the same assembly in a project) the prefix will 

break the links the rules have in the assembly, due to the rules refering to parameters in parts using the part name (which just changed due to the prefix)

 

for instance: (using a prefix "n1_")

SyntaxEditor Code Snippet

If MAAT="DN25" And DIN_ASTM="DIN" Then
Parameter("BLINDFLENS:1", "MAAT")="DN25"

the partname "blindflens:1" would change to  "n1_blindflens:1", but the reference in the rule wont change to that "n1_blindflens:1"

 

im looking for way to change the reference in the rule to add in the prefix. (or any other solution that would fix this)

 

 

 

0 Likes
Accepted solutions (1)
2,402 Views
11 Replies
Replies (11)
Message 2 of 12

Vadim-the-Engineer
Advocate
Advocate

Rule code is text and not a parameter - it would not change upon editing parameter name... However the substitution in code is easy: just select the one you want to change go to "Model" tab, in the tree, there are all model components, double-click it and you are good to go.

I hope that helped. Good luck!

0 Likes
Message 3 of 12

Vadim-the-Engineer
Advocate
Advocate

There is a hard way also (Visual Basic coding) but I'm too underskilled in VBA yet, but there are monsters of Autodesk here who can help for sure

0 Likes
Message 4 of 12

Anonymous
Not applicable

thanks for the reply, i have been using those model parameter references however these will not change when the part filename changes.

i found that changing the name of the part in the assembly browser fixes the problem but having to manually change every part name (can be more than 200 in the future) isnt a long term solution.

0 Likes
Message 5 of 12

MjDeck
Autodesk
Autodesk
Accepted solution

It's better to rename the components in the model browser. If you rename them in the original assembly, then they will remain the same in the copies.

But if you don't want to do that, here's an alternative:

- in the assembly, launch the Parameters command and create a new Text parameter named FilePrefix. Leave it empty (blank) to start.
- edit the rules to add that prefix to all the component names:

Parameter(FilePrefix & "BLINDFLENS:1", "MAAT")="DN25"

 

Leave the FilePrefix parameter empty in the original assembly. In a copy, you have to change it (to "n1_" for example). But you only have one thing to change. Change the parameter and all the rules will see the change.

 

One strange thing: in the Parameters dialog you can't change a Text parameter to blank if it is not so already. If you ever need to clear the string, yo ucan create and run a temporary rule like this:
Parameter("FilePrefix") = String.Empty

 


Mike Deck
Software Developer
Autodesk, Inc.

Message 6 of 12

Anonymous
Not applicable

ill try it out soon, but this seems to be the thing i was looking for, thank you very much

0 Likes
Message 7 of 12

Anonymous
Not applicable

tested it, made a little change to the code

SyntaxEditor Code Snippet

Parameter("FilePrefix")&

 it being like this now

SyntaxEditor Code Snippet

MOERDIKTE=Parameter(Parameter("FilePrefix")&"DIN934:1", "M")

 and it works like a charm

0 Likes
Message 8 of 12

gavin.allenHSSRX
Enthusiast
Enthusiast

Good Morning All,

I am having the same kind of issue, links to parts and their parameters or links to an Excel spreadsheet for the parameters data in the iLogic rules, all, don't work after the copy design.
The solution above may work for you and others, but alas not for me and the way we work.

 

SO, the old grey matter is ticking now, if I can link all my parameters that need to change, back to a single Excel sheet, when I do a copy design and the name of the Excel sheet changes, to that of the top level assy (keeps life simple), is there a rule/VB coding that I can use from the top level assy file, that will edit the rules down thru all the subsequent files?

K.I.S.S. (keep it simple stupid)
Life doesn't have to be complicated.
Designs don't have to be complicated.
GOD Bless you.
0 Likes
Message 9 of 12

Anonymous
Not applicable

Hi, 

 

i worked on this assembly that can me changed using the excel file 

using icopy you can copy all the files connected to the assembly 

and giving it a prefix like "818_" or "new_project_"

and then changing the empty text in the now copied assembly using the same prefix

the excel will then alter the assembly.

 

Hope this is what you mean and that it might help

0 Likes
Message 10 of 12

gavin.allenHSSRX
Enthusiast
Enthusiast

Hi Jurriaan,

I appreciate your comments and help. I have looked at what you have attached and your suggestion, this solution will not work for me, sorry.

 

I have an Excel sheet which I use to control a complete assembly and it's parts. I then have iLogic rules which I use in all the parts and assemblies to write back to the iProperties. I also have iLogic rules which control and set views in my drawings.

 

All these rules either link back directly to the Excel sheet or to a part/assembly file, that does link back to the Excel. 

When I copy the design in vault, I have a set of parts that I know will change and subsequently the assemblies that they are a part of and then all the drawings. 

Each part and assembly has a new drawing number, which is then the new file name, and the Excel sheet gets the same number as the top level assembly.

 

So all the rules that call upon the Excel or a Part, break. I need a way to fix this.

I could keep the same Excel file, but then I need to find a way to lock off all the parts and assemblies so they don't change again when I alter the spread sheet for a new version of the design.

 

Regards

Gavin

 

 

 

 

K.I.S.S. (keep it simple stupid)
Life doesn't have to be complicated.
Designs don't have to be complicated.
GOD Bless you.
0 Likes
Message 11 of 12

Anonymous
Not applicable

do you have an expample of this ? knowing how to do this might be usefull for me to use to

0 Likes
Message 12 of 12

gavin.allenHSSRX
Enthusiast
Enthusiast

The Coding for the drawings is as follows, though I do tweak it for each drawing if I need to.  

trigger = iTrigger0
iTrigger0 = iLogicVb.RunRule("Rule0")

'VIEW 1 - SETTINGS
ActiveSheet.View("VIEW1").Scale = (1) 'This sets the scale size
ActiveSheet.View("VIEW1").SetSpacingToCorner(0.0, 140.0, SheetCorner.BottomLeft) 'This sets the position of the view, referenced to a corner

'If (ActiveSheet.Name <> "Sheet:1") Then Return 'This checks to make sure that you are on sheet 1, if so it carries on
        
Dim viewL = ActiveSheet.View("VIEW1") 'This looks like it sets the value of VIEW1 to viewL
Dim view = viewL.View                                   'then this sets the value in viewL to that of view (please note the capitalisms)

If (view.BreakOperations.Count > 0) Then 'This checks if there is a break view already
Try
Catch
End Try

Try
view.BreakOperations(1).Delete                          'if there is then this line deletes it first
Catch
End Try

End If

ActiveSheet.View("VIEW1").SetSpacingToCorner(0.0, 140.0, SheetCorner.BottomLeft) 'This sets the position of the view, referenced to a corner

modelLength = GoExcel.CellValue("D:\Training Vault\Drawings\Z Conveyor MASTER\0\Conveyor MASTER Control DATA.xlsx", "Inventor", "B18")
If (modelLength > 1194.0) Then 'This gets a value from Excel and checks it against a set value

ActiveSheet.View("VIEW1").SetSpacingToCorner(0.0, 140.0, SheetCorner.BottomLeft) 'This sets the position of the view, referenced to a corner

Dim breakWidth As Double = (modelLength - 1090.0) 'This sets the break size

Dim xMid As Double = GoExcel.CellValue("D:\Training Vault\Drawings\Z Conveyor MASTER\0\Conveyor MASTER Control DATA.xlsx", "Inventor", "F18") 'This sets the X dimension for the new break to be

Dim startPt_preSplit = ThisApplication.TransientGeometry.CreatePoint2d((xMid - breakWidth / 4) * 0.1, 0) 'This sets the start point of the break
Dim endPt_preSplit = ThisApplication.TransientGeometry.CreatePoint2d((xMid + breakWidth / 4) * 0.1, 0) 'This sets the end point of the break
view.BreakOperations.Add(BreakOrientationEnum.kHorizontalBreakOrientation, startPt_preSplit, endPt_preSplit) 'This puts in a Horizontal break

ActiveSheet.View("VIEW1").SetSpacingToCorner(0.0, 140.0, SheetCorner.BottomLeft) 'This sets the position of the view, referenced to a corner

Dim oxMid As Double = GoExcel.CellValue("D:\Training Vault\Drawings\Z Conveyor MASTER\0\Conveyor MASTER Control DATA.xlsx", "Inventor", "H18") 'This sets the X dimension for the new break to be

Dim startPt_postSplit = ThisApplication.TransientGeometry.CreatePoint2d((oxMid - breakWidth / 4) * 0.1, 0) 'This sets the start point of the break
Dim endPt_postSplit = ThisApplication.TransientGeometry.CreatePoint2d((oxMid + breakWidth / 4) * 0.1, 0) 'This sets the end point of the break
view.BreakOperations.Add(BreakOrientationEnum.kHorizontalBreakOrientation, startPt_postSplit, endPt_postSplit) 'This puts in a Horizontal break

End If

ActiveSheet.View("VIEW1").SetSpacingToCorner(0.0, 140.0, SheetCorner.BottomLeft) 'This sets the position of the view, referenced to a corner


ActiveSheet.View("VIEW1").Scale = (350 / ActiveSheet.View("VIEW1").Width) 'This sets the scale size to my 450mm I require divided by the value of View Width
ActiveSheet.View("VIEW1").SetSpacingToCorner(85, 140, SheetCorner.BottomLeft) 'This sets the position of the view, referenced to a corner

'VIEW 2 - SETTINGS
ActiveSheet.View("VIEW2").SpacingBetween("VIEW1") = 110 'This sets view2 away from the fixed view1 by 130mm

'VIEW 3 - SETTINGS
ActiveSheet.View("VIEW3").SpacingBetween("VIEW1") = 150 'This sets view2 away from the fixed view1 by 150mm

'VIEW 4 - SETTINGS
ActiveSheet.View("VIEW4").Scale = (1) 'This sets the scale size
ActiveSheet.View("VIEW4").Scale = (280 / ActiveSheet.View("VIEW4").Width) 'This sets the scale size to my 210mm I require divided by the value of View Width
ActiveSheet.View("VIEW4").SetSpacingToCorner(10, 10, SheetCorner.TopRight) 'This sets the position of the view, referenced to a corner

This coding is for the following drawing. Though I have not run it yet

example 1.png

K.I.S.S. (keep it simple stupid)
Life doesn't have to be complicated.
Designs don't have to be complicated.
GOD Bless you.