How to get part documents from draft file?

Hi,

I want to retrieve properties of parts present in draft file. Here we have draft file as input. What are the steps to get part documents of parts present in draft file?

 

If anybody has example, Please share it.

 

Thanks in advance.

 

-Amit

 

Posted by: Amit Wadekar
Post date: 5/8/2012 9:36:14 AM

3 REPLIES

Re: How to get part documents from draft file?

Amit,

 

you get access to the referenced model(s) from a draft file as follows:

 

Loop through all sheets of the Sheets collection of the DraftDocument object.

Loop through all DrawingView objects of the DrawingViews collection of each Sheet object.

The ModelLink object of a DrawingView object is what you are searching for.

 

Posted by: Wolfgang Kunert
Post date: 5/9/2012 2:31:11 AM

Re: How to get part documents from draft file?

Hi Amit,

 

As Wolfgang Kunert said you can use the "ModelLinks" object. And here is an exemple :

 

Dim dftDoc As SolidEdgeDraft.DraftDocument

Dim sEApp As SolidEdgeFramework.Application

Dim occurrences As SolidEdgeAssembly.Occurrences

Dim occurrence As SolidEdgeAssembly.Occurrence

 

'Get your Draft document

dftDoc = sEApp.ActiveDocument

 

Dim oChildModels As SolidEdgeDraft.ModelLinks = dftDoc.ModelLinks

Dim oChildModel As SolidEdgeDraft.ModelLink

Dim obj As Object

Dim objPart As Object

 

For Each oChildModel In oChildModels

obj = oChildModel.ModelDocument

 

'Your treatment here..

...

 

'if linkModel is an assembly you can get your Part documents using "Occurrences" object :

occurrences = obj.Occurrences

For Each occurrence In occurrences

objPart = occurrence.OccurrenceDocument

'Your treatment on Parts here..

...

Next

Next

 

 

 

Regards,

Tamer

 

Posted by: Tamer EL BAKKALI
Post date: 5/9/2012 6:27:02 AM

Re: How to get part documents from draft file?

Thank you Wolfgang Kunert and Tamer for your quick reply. Smiley Happy

 

Posted by: Amit Wadekar
Post date: 5/10/2012 12:40:32 AM