Ilogic reading what file type is used for a derived part

Ilogic reading what file type is used for a derived part

Anonymous
Not applicable
668 Views
3 Replies
Message 1 of 4

Ilogic reading what file type is used for a derived part

Anonymous
Not applicable

After searching and hurting my head trying to figure out the code here is basically what I am trying to do.

 

in  a drawing place a single view of a part.

Part is derived from either a part or an assembly

 

Ilogic to read what the file type is being derived in and run appropriate code

 

Part: DerivedPartComponents

Assembly: DerivedAssemblyComponents

 

I have searched and only found suggestions on how to create derived parts. I need it to read the file type of the Derived file in the part.

All help in this matter will be greatly appreciated.

I am able to get the program to work if I keep to the part or the assembly however then I would need two codes written and have the user decide which code to use. I would prefer having one code that Read the .ipt or .iam from the derived link. One other possible layer that will need to be addressed is that these files are in iparts.(already have a possible solution for this.

0 Likes
Accepted solutions (1)
669 Views
3 Replies
Replies (3)
Message 2 of 4

andrewiv
Advisor
Advisor
Accepted solution

Here is a quick code that will do what I think you are looking for.

Dim oDoc As DrawingDocument
Dim oSheet As Sheet
Dim oDwgView As DrawingView
Dim oModelDoc As Document
Dim oBaseDoc As Document

oDoc = ThisApplication.ActiveDocument
oDwgView = oDoc.Sheets.Item(1).DrawingViews.Item(1)
oModelDoc = oDwgView.ReferencedDocumentDescriptor.ReferencedDocument
oBaseDoc = oModelDoc.ReferencedDocuments.Item(1)

If oBaseDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
	MessageBox.Show("This is a part")
	
ElseIf oBaseDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
	MessageBox.Show("This is an assembly")
	
End If

Andrew In’t Veld
Designer / CAD Administrator

Message 3 of 4

Anonymous
Not applicable

I will test this out and let you know. Thanks for the fast response.

0 Likes
Message 4 of 4

Anonymous
Not applicable

One other Caveat that I am working with Is I want the properties for the number and description to populate the Parts list which I was able to modify from another source however I am now getting an error with either the assembly or the part direction. 

 

Otherwise the Code works great. I figured it was going to be something simple and I just couldn't wrap my head around it at the moment. so thank you for that.

0 Likes