Rule in drawing: To retrieve custom properties of a non-model drawing

Rule in drawing: To retrieve custom properties of a non-model drawing

RoyWickrama_RWEI
Advisor Advisor
477 Views
3 Replies
Message 1 of 4

Rule in drawing: To retrieve custom properties of a non-model drawing

RoyWickrama_RWEI
Advisor
Advisor

Rule in drawing document: Using the following

oModelDoc = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName)

I retrieve model document properties in to the drawing document and vice versa.

Recently, with the same rule running in drawing, I also need to retrieve such data from a part or assembly of a non-model-document.

Path and file name of this other document is known. Please see below! Can I retrieve the description (for example) of this other document. I tried my best without success. Request help. Thank you.

Sub Main()
oModelDoc = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName)
	oDoc = ThisDrawing.ModelDocument
	Dim invCustomProps As Inventor.PropertySet
	invCustomProps = oDoc.PropertySets.Item("User Defined Properties")
	Dim invCustomProp As Inventor.Property
Description_Model = iProperties.Value(oModelDoc, "Project", "Description")
MessageBox.Show("Model_Desn: " & Description_Model, "Title")

oDoc_Other = "C:\$WF_DHAMAG\Projects\DHAMAG_SDAI\ADSI-P001-ARF33\P001-A0001.iam"

Description_Other = ?????????????????

End Sub

Drawing (for Example): C:\$WF_DHAMAG\Projects\DHAMAG_SDAI\ADSI-P001-ARF33\P001-A0001.iam

Model Document (for example): C:\$WF_DHAMAG\Projects\DHAMAG_SDAI\ADSI-P001-ARF33\P001-sa1001.idw

Other Document (Example): C:\$WF_DHAMAG\Projects\DHAMAG_SDAI\ADSI-P001-ARF33\P001-A0001.iam

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

RoyWickrama_RWEI
Advisor
Advisor

@RoyWickrama_RWEI wrote:

Rule in drawing document: Using the following

oModelDoc = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName)

I retrieve model document properties in to the drawing document and vice versa.

Recently, with the same rule running in drawing, I also need to retrieve such data from a part or assembly of a non-model-document.

Path and file name of this other document is known. Please see below! Can I retrieve the description (for example) of this other document. I tried my best without success. Request help. Thank you.

Sub Main()
oModelDoc = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName)
	oDoc = ThisDrawing.ModelDocument
	Dim invCustomProps As Inventor.PropertySet
	invCustomProps = oDoc.PropertySets.Item("User Defined Properties")
	Dim invCustomProp As Inventor.Property
Description_Model = iProperties.Value(oModelDoc, "Project", "Description")
MessageBox.Show("Model_Desn: " & Description_Model, "Title")

oDoc_Other = "C:\$WF_DHAMAG\Projects\DHAMAG_SDAI\ADSI-P001-ARF33\P001-A0001.iam"

Description_Other = ?????????????????

End Sub

Drawing (for Example): C:\$WF_DHAMAG\Projects\DHAMAG_SDAI\ADSI-P001-ARF33\P001-A0001.iam

Model Document (for example): C:\$WF_DHAMAG\Projects\DHAMAG_SDAI\ADSI-P001-ARF33\P001-sa1001.idw

Other Document (Example): C:\$WF_DHAMAG\Projects\DHAMAG_SDAI\ADSI-P001-ARF33\P001-A0001.iam


o Post.png

0 Likes
Message 3 of 4

chandra.shekar.g
Autodesk Support
Autodesk Support
Accepted solution

@RoyWickrama_RWEI,

 

Try below code to get iProperties of non model document.

 

oDoc_Other = C:\$WF_DHAMAG\Projects\DHAMAG_SDAI\ADSI-P001-ARF33\P001-A0001.iam

Dim oDoc As Document oDoc = ThisApplication.Documents.Open(oDoc_Other, False) Dim oDescription As String oDescription = oDoc.PropertySets.Item("Design Tracking Properties").Item("Description").Value MessageBox.Show(oDescription, "Title")

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 4 of 4

RoyWickrama_RWEI
Advisor
Advisor

Thanks a lot, Sir.

It does exactly what I need currently.

0 Likes