Ilogic assembly save

Ilogic assembly save

joakim.boge
Contributor Contributor
460 Views
7 Replies
Message 1 of 8

Ilogic assembly save

joakim.boge
Contributor
Contributor

Hello. 

i have a question about saving when i am making a new assembly with some of my ilogic parts ( assembly’s) placed inn. If a make a change to one of the ilogic assemblys in the new assembly, if i am not mistaken, then in every other assembly where i have used the ilogic part change too? 

what is the best workflow when working with ilogic parts and forms? 

In my case i have made a belt conveyor with ilogic form where i can change the width of the conveyor, and the project that i am working on has two conveyor, only difference between is the width. Do i need to make a copy design  of the assemblys to make this work the way I want?

Almost all parts will be the same, only the width is different. 

thanks in advance. Hopefully you will understand my question.

 

 

0 Likes
461 Views
7 Replies
Replies (7)
Message 2 of 8

A.Acheson
Mentor
Mentor

Some generic advice. Hopefully others will add to this as well. 

Try and keep as little ilogic internal rules/forms within the documents themselves. Any code improvements will need to be updated in each document if changes are needed. Try where possible to use external rules and forms. One location and one document to update. 

 

If internal ilogic is used ensure to stabilize browser names in assemblies. Then use place ilogic component or ilogic copy design to copy the assemblies and update the internal ilogic references. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 3 of 8

joakim.boge
Contributor
Contributor

Ok, thanks for your reply. I will have a look at global forms and rules, haven’t used it before.
When using place ilogic component, will this make a copy of the original file?

0 Likes
Message 4 of 8

A.Acheson
Mentor
Mentor

Ilogic place component will make a copy of the assembly and any parts controlled by ilogic(changeable). Internal ilogic rules and the presence of parameters should be enough to recognize that the occurrence is being driven by ilogic and therefore  (changeable). The assembly and part filename will get an indexed number and be saved in the workspace. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 5 of 8

joakim.boge
Contributor
Contributor

I did some research on place ilogic components after your last reply and it looks like the solution that I was looking for. 
one other question I have when it comes to ilogic place command, most of my ilogic parts is made with multi-body parts, and make components when is becomes an assembly. And in the assembly i have the multi body parts as a reference to drive the ilogic form in the assembly. 
is there a way to control it only from the assembly without inserting the multibody as a reference? 
it is only two parameters i want to drive, width and length. 


sorry for all of my questions. 

 

0 Likes
Message 6 of 8

A.Acheson
Mentor
Mentor

I am not sure how the parent multibody technique will work with ilogic place component. So you may need to do further testing. My preference would be to keep it in the assembly as it will drive all the parts internally.

 

The most common way is to have the parent multibody part in the assembly. This is useful for anyone trying to figure out either by code or manually how the parts are made. However if you choose not to have it in the assembly there are a few options. 

1. Know exactly the fullfilename of the Parent Part, open and adjust the parameter.

2. Loop through the assembly, look for derived parts, find it's referenced part the parent then adjust the parameter.

The code below will do this. It might fall down if you have other derived parts or the parameter is not unique but hopefully you get the idea of it's use. 

Dim Length As String = InputBox("Enter Length", "Parameter InputBox", "1 in ")

For Each doc As Document In ThisDoc.Document.AllReferencedDocuments

	If doc.DocumentType = kPartDocumentObject Then
		
		Dim oDerDoc As PartDocument = doc
		'Look for Derived part components
		If oDerDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents.Count < 1 Then
			'MessageBox.Show("No Derived Part Components in this part", "iLogic")   
		ElseIf oDerDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents.Count > 1 Then
			'MessageBox.Show("More than one Derived Part Components in this part,Exiting!", "iLogic") 
		Else
			' Set a reference to the part component definition
			Dim oDerCompDef As PartComponentDefinition = oDerDoc.ComponentDefinition
			
			'Get a reference to derived part components in this part
			Dim oDerComps As DerivedPartComponents = oDerCompDef.ReferenceComponents.DerivedPartComponents
			
			'Get a reference to derived part component
			Dim oDerComp As DerivedPartComponent = oDerComps(1)'1st component
			'MessageBox.Show(oDerComp.Name, "iLogic")
			
			' Get the Reference document the parent.
			Dim oRefDoc As PartDocument = oDerComp.ReferencedDocumentDescriptor.ReferencedDocument
			
			'Change the parameter of the parent
			oRefDoc.ComponentDefinition.Parameters("Length").Expression = Length
			MessageBox.Show("Parameter Changed in Parent", "Success")
	        
			'Creates the iProperty in the derived part and assigns the iProperty value of the refDoc
			iProperties.Value(doc.DisplayName,"Custom", "ParentPartNumber") = iProperties.Value(oRefDoc.DisplayName,"Project", "Part Number")
			MessageBox.Show("iProperty Copied from Parent to Child", "Success")
		End If
	End If	   
Next

 

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 7 of 8

joakim.boge
Contributor
Contributor

i tried your code and it works well, thank you for that, i realy appreciate it. i have done some testing with the place ilogic component in a assembly, with a parameter that will control the width, ( did some youtube search ) 

and i get an error when i place my part ( se my added pictures ) yes i know it is in norwegian. 

 

It is looking for the previus multibody part named :1 and in the new assembly it is :2. 

i did it manualy this time by changing the number. 

Is this something that can be done by code, or do i have to do it manualy everytime i place it? 

 

I will  look into global forms and external rules, not sure on how to set it up so it works in each assembly. 

 

 

ilogic.JPGilogic fault.JPG

 

Thank you for all your help so far. 

0 Likes
Message 8 of 8

A.Acheson
Mentor
Mentor

If you are swapping parts/assembly what you need to do is rename the occurrence name " 11111:1" to a generic name like "Plate1".

This now becomes your reference in the model and in the code. When you swap "plate1" component with another what happens is the file reference (fullfilename, constraints etc) is change behind the scenes but your assembly still sees "Plate1". You could call it a place holder.

Link here with full explanation.

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes