How can I use iLogic to change size of components?

How can I use iLogic to change size of components?

Brian.Price
Advocate Advocate
4,177 Views
13 Replies
Message 1 of 14

How can I use iLogic to change size of components?

Brian.Price
Advocate
Advocate

I have an assembly with 3 parts, 2 of which are content center files that never change. The third file must be custom as it needs a different length every time. I can use iLogic to point to the 2 content center files and have them update according to the input. How can I then use iLogic to change the size of the third part according to the input and match the other 2 parts? The third part is set up in content center and is always saved as a custom part to be used in each unique assembly.

 

Normally I would go to each component and use the change size feature on each. When I get to the third I would also input the length I need.

I think being able to change size on each component would be easier too instead of using, if input = this then part = this.

 

Thanks.

0 Likes
4,178 Views
13 Replies
Replies (13)
Message 2 of 14

bradeneuropeArthur
Mentor
Mentor
Why don't you make the part adaptive. Then you don't need any coding. Inventor out of the box solution..

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 14

Brian.Price
Advocate
Advocate

The third part is a  piece of pipe that follows ASME standards and is already in the content center that regulates I.D. and O.D. I would have to remember or set up each piece to have that info along with the material separately.

0 Likes
Message 4 of 14

bradeneuropeArthur
Mentor
Mentor
can also be done with CC parts.

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 5 of 14

Brian.Price
Advocate
Advocate

Not sure how I would be able to do that.

 

I would need sizes from schedule 10 up to 160 on pipe sizes from 1/2" to 24". Plus the information is set up in the content center for the part number, description, material, and special customer only information.. Another reason is that I use the change size feature while changing numerous custom parts that could be automated using iLogic, such as structural shapes, angle, flat bar, I-Beams etc. I prefer to drive my assemblies from a form that incorporates most of the needed information, and I simply place the parts/sub assemblies in the correct location.

 

I should point out I am hesitant to use the adaptive feature due to it not acting correctly by not updating, losing reference, and sometimes just freaking out. If I were to make the parts adaptive I would have to set that up on each assembly if I am correct. If I use my iLogic rules to do this I simply have to have the same name and parameters already set up in the parts that I use in my library. I can then place them in my assembly and they are ready to go.

0 Likes
Message 6 of 14

bradeneuropeArthur
Mentor
Mentor

I don't know why you think that is easier?

I think without programming is the simples and easiest way, also regarding future updates.
But maybe i am misunderstanding your question.

Programming is in that way an issue when you are not familiar with the code and only making programs or coding work without re-writing or repreduced it completely your selves.
Also for not programmers it is always easier to try to solve it with something out of the box ie with selve programming.

Regards,

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 7 of 14

Brian.Price
Advocate
Advocate

I'm not necessarily looking for easier, I am looking for more consistence with fewer errors. If I only input the info once it is either correct everywhere or wrong everywhere, and easier to spot. I already have my assemblies set up with the pipe sizes that have to be cut in the sheet metal that these go. I design cylindrical containment tanks. I have 3 inputs. Size, Elevation, Orientation. It then cuts the holes in the correct places and aligns the axis to these holes so that I can place nozzles in the correct places. I have numerous other inputs as well, shell height, shell orientation, material, tank I.D., tank height, tank thickness. These inputs take my design time down from 3 days to 1 and increase my consistency phenomenally while decreasing my errors.

 

With the inputs already there I can then further my code to change the nozzle to the correct size. These are not simple models and assemblies, so the complexity of adaptive features would be high. Also I would have to make each nozzle adaptive to the assembly on all tanks, instead of making one model that ties to the iLogic and always updates to the rules. By making my modelling time so short I can then dedicate more time to detailing drawings.

 

While I appreciate your method of adaptivity, I don't believe it is the best method for my assemblies. If in the end I have to go to each nozzle and change the size manually I can, but automating that process would again lower errors and save time.

0 Likes
Message 8 of 14

Anonymous
Not applicable

Brian,

   If I read this properly you are placing the parts from content center and you want to change the  length of a pipe based on the given parameters. I assume you have the logic worked out to determine the length.

If the pipes you are using have the come from the content center and have PL parameter then you should be able to use the parameter snippet to change the length of the pipe ala 

SyntaxEditor Code Snippet

Parameter("ISO 3633 Pipe with Single Socket for Elastomeric Sealing Ring Joints DN32 - 200:1", "PL")= 10

This will change the length on your local copy. 

if this doesn't solve your problem post the code/rule you have and I'll see if I can work out a solution.

 

0 Likes
Message 9 of 14

Brian.Price
Advocate
Advocate

I don't think I'm explaining it well. 

 

Currently I can program the iLogic to use if/then to get the parts I need using the filename. I would like to make template assembly that I can change size of the components. I can currently click on each part of the assembly and change it's size accordingling. However I would like to use only a few inputs to change the components.

 

The three components for the nozzles are:

1. the Flange - consistently uses the same part on all specific sized nozzle part is not custom and comes from the content center library.

2. the Stud Flange- consistently uses the same part on all specific sized nozzle part is not custom and comes from the content center library.

3. the pipe - is a custom part and the length changes every time, the file is saved to the project folder. Also the schedule of the pipe can change as well.

 

If I could use an input that says 6", 304 SS, Schedule 40, it would then change the size of each part according to what is provided in the content center.

 

I currently have code in the master assembly for the size and material. This would be used in my tank template I use and each nozzle would start out as a generic size, the code would then modify each to what the new inputs tell them.

 

My other thought is to assemble multiple nozzles with the correct sizes and variations and copy them to the project folder.

 

TLDR: Can you use the change size feature in Ilogic?

0 Likes
Message 10 of 14

chandra.shekar.g
Autodesk Support
Autodesk Support

@Brian.Price,

 

 

Seems that iAssembly would serve the purpose. Below YouTube link explains about iAssembly.

 

https://www.youtube.com/watch?v=pN3mIZvQ24I

 

Meanwhile, Could you please provide sample assembly which contains Flange, Stud Flange and Pipe? Also mention some 3 to 5 variations to test.

 

Please make sure that files are non confidential.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 11 of 14

Brian.Price
Advocate
Advocate

That is essentially what I want to do however these parts are already modeled in content center.  I believe for this to work I would have to remake the parts, not sure if I can copy the content center family somehow and use that to make new Iparts?

0 Likes
Message 12 of 14

chandra.shekar.g
Autodesk Support
Autodesk Support

@Brian.Price,

 

Below iLogic code is to change the row of content center file in assembly.

 

'This iLogic demo replaces the given standard component
'with another member from same family.

' row number of the new family member .
Dim NewRow As Integer = 10

'active assembly s
Dim oMainAsm As AssemblyDocument = ThisDoc.Document
Dim oAsmDef As AssemblyComponentDefinition = oMainAsm.ComponentDefinition

' get the occurrence by its position in the occurrences collection
Dim oOcc As ComponentOccurrence = oAsmDef.Occurrences.Item(1)
Dim oDef As PartComponentDefinition = oOcc.Definition
Dim oDoc As PartDocument = oDef.Document

'reference to the CC properties - oProps
Dim oPropSets As PropertySets = oDoc.PropertySets
Dim oProps As PropertySet = oPropSets.Item("Content Library Component Properties")

' family id
Dim oProp As Inventor.Property = oProps.Item("FamilyId")
Dim FamilyId As String = oProp.Value
'MsgBox("FamilyId: " + FamilyId)

'reference to the ContentFamily
Dim oContentCenter As ContentCenter = ThisApplication.ContentCenter
Dim oFamily As ContentFamily = oContentCenter.GetContentObject("v3#" + FamilyId + "#")  
'MsgBox("Content Family DisplayName:  " + oFamily.DisplayName & vbNewLine & _
'	    "Rows in Family:  " & oFamily.TableRows.Count )

'create new member file
Dim ErrorType As MemberManagerErrorsEnum
Dim strContentPartFileName As String
Dim strErrorMessage As String
strContentPartFileName = oFamily.CreateMember(NewRow, ErrorType, strErrorMessage)

'replace the existing component with the new one
oOcc.Replace(strContentPartFileName, False)

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 13 of 14

duncpol
Participant
Participant

This changes the diameter of the pipe. But how to change the pipe length ("PN" parameter) or "G_L" parameter of any STANDARD content center part? If it was a part from content center inserted as "custom" it would be easy, since it is not write protected. The code has to be equivalent to right click on part->"Change size..." command -> user input to "PN" or "Length" column,  and not to selecting a new row in family members.

0 Likes
Message 14 of 14

duncpol
Participant
Participant

For Content center parts inserted as "standard", I would do this:

 

'This iLogic demo replaces the given standard component
'with another member from same family.

' row number of the new family member .
Dim NewRow As Integer = 10

'active assembly s
Dim oMainAsm As AssemblyDocument = ThisDoc.Document
Dim oAsmDef As AssemblyComponentDefinition = oMainAsm.ComponentDefinition

' get the occurrence by its position in the occurrences collection
Dim oOcc As ComponentOccurrence = oAsmDef.Occurrences.Item(1)
'MsgBox (oOcc.Name)

Dim oDef As PartComponentDefinition = oOcc.Definition
Dim oDoc As PartDocument = oDef.Document

'reference to the CC properties - oProps
Dim oPropSets As PropertySets = oDoc.PropertySets
Dim oProps As PropertySet = oPropSets.Item("Content Library Component Properties")

' family id
Dim oProp As Inventor.Property = oProps.Item("FamilyId")
Dim FamilyId As String = oProp.Value
'MsgBox("FamilyId: " + FamilyId)

'reference to the ContentFamily
Dim oContentCenter As ContentCenter = ThisApplication.ContentCenter
Dim oFamily As ContentFamily = oContentCenter.GetContentObject("v3#" + FamilyId + "#")  
'MsgBox("Content Family DisplayName:  " + oFamily.DisplayName & vbNewLine & _
'	    "Rows in Family:  " & oFamily.TableRows.Count ) '"v3#" + FamilyId + "#"

'create new member file
Dim ErrorType As MemberManagerErrorsEnum
Dim strContentPartFileName As String
Dim strErrorMessage As String

Dim oCustomInput As NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap
'Set the pipe length
oCustomInput.Value("PL")=600


strContentPartFileName = oFamily.CreateMember(NewRow, ErrorType, strErrorMessage, , , ,oCustomInput)

'replace the existing component with the new one
oOcc.Replace(strContentPartFileName, False)

 

0 Likes