Accessing form in a part from an assembly

Accessing form in a part from an assembly

berry.lejeune
Advocate Advocate
448 Views
6 Replies
Message 1 of 7

Accessing form in a part from an assembly

berry.lejeune
Advocate
Advocate

Hi everyone,

 

As i'm trying to make my workflow a bit easier I've come to a litte problem.

In attached screenshot (#1)  you can see the part "sketch koffer borduur" In this part I've made a sketch that includes all the dimension and outlines for my parts. There's also a form in this part that I can call up and enter all the dimensions required to make my model (#2)

Is there a way that I can call up this form with the "iTrigger" in my main assembly? Now I've got to go first into my part and then access 'Ilogic" and "forms" tab to access it.

I copied the form from my part to my assembly. But then I couldn't access the parameters anymore (#3)

Screenshot_396.pngScreenshot_397.pngScreenshot_398.png

 

Thanks

 

Berry

 

 

 

 

 

0 Likes
Accepted solutions (1)
449 Views
6 Replies
Replies (6)
Message 2 of 7

Hubert_Los
Advocate
Advocate

You can create user parameters with the same name. Then your rule will work because it looks in the open document, for parameters with the given name. Then you can write a rule in iLogic that will copy parameters from assembly to part. This is a bit time-consuming. Or you can write your own rule in ilogic that will refer to the part. However, this is more complicated

0 Likes
Message 3 of 7

marcin_otręba
Advisor
Advisor

Hi,

 

I see two possibilities:

 

1. go trough select set and choose geometry part, after that you can access its properties, geometry and so on.

 

Dim sel_set As SelectSet
sel_set = ThisDoc.Document.SelectSet


If sel_set.Count = 1 Then
	If TypeOf sel_set.Item(1) Is ComponentOccurrence Then
	Dim doc As Document
	doc = sel_set.Item(1).definition.document  '  you can access all here 
MessageBox.Show(doc.FullFileName, "Title") 


	Else
		MessageBox.Show("part or assembly must be selected", "Title")
End If
	Else
MessageBox.Show("Only one component can be selected", "Title") 
Exit Sub
End If

 

2. go to part trough assembly component occurrences or allreferenced documents.

Dim ass As AssemblyDocument = ThisApplication.ActiveEditDocument
Dim doc As PartDocument
For Each xdoc As Document In ass.AllReferencedDocuments 
	If xdoc.FullFileName.Contains("sketch koffer borduur.ipt") Then
		doc = xdoc ' here you can access all
		MessageBox.Show(doc.FullFileName, "Title")

	End If
Next
		

 

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

0 Likes
Message 4 of 7

berry.lejeune
Advocate
Advocate

My programming skills are next to nothing. Everything what I use for Ilogics and forms I gattered around the internet and this forum and then tweaked it a bit to fit my needs

0 Likes
Message 5 of 7

berry.lejeune
Advocate
Advocate

When I use your rule, it gives me the location of the part on my driveScreenshot_399.png

0 Likes
Message 6 of 7

marcin_otręba
Advisor
Advisor
Accepted solution

I think i found better idea,

 

in your poart add rule named "show_form" for example in wchich add only:

 

 

iLogicForm.Show("write here your form name")

 

 

 

then in assembly you can add:

 

Dim ass As AssemblyDocument = ThisApplication.ActiveEditDocument
For Each comp As ComponentOccurrence In ass.ComponentDefinition.Occurrences 
	If comp.Name.Contains("sketch koffer borduur") Then
		 iLogicVb.RunRule(comp.Name, "show_form")
	End If
Next
	
			

 

 

 

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

Message 7 of 7

berry.lejeune
Advocate
Advocate

@marcin_otręba thank you very much 👍 

I just had to change some names of the forms in your rule and it works!!

0 Likes