Asses AutoCAD dwg Custom properties with iLogic

Asses AutoCAD dwg Custom properties with iLogic

RasmusBredal
Advocate Advocate
376 Views
2 Replies
Message 1 of 3

Asses AutoCAD dwg Custom properties with iLogic

RasmusBredal
Advocate
Advocate

Hi All

 

I have a drawing where there is a ReferencedOLE link to C: \ temp \ 4217901.dwg.

 

OLELinkInventor.png

 

I would like to read some Custom Properties into my Inventor drawing.

 

fx System

AutocadProp.png

 

I can get the ReferencedOLEFile path with this code: 

Dim oDoc As Document
oDoc = ThisApplication.ActiveDocument

If oDoc.ReferencedOLEFileDescriptors.Count = 0 Then
    MessageBox.Show("There aren't any OLE references in this document.", "OLE - iLogic")
    Exit Sub
End If

Dim aOLERefs() As ReferencedOLEFileDescriptor
ReDim aOLERefs(oDoc.ReferencedOLEFileDescriptors.Count - 1)

Dim iRefCount As Integer
iRefCount = oDoc.ReferencedOLEFileDescriptors.Count
Dim i As Integer
For i = 1 To iRefCount
    aOLERefs(i - 1) = oDoc.ReferencedOLEFileDescriptors.Item(i)
	MessageBox.Show(aOLERefs(i - 1).FullFileName, "OLE Path")	
Next

Is it possible to read Custom Properties with System.io.file?

 

0 Likes
377 Views
2 Replies
Replies (2)
Message 2 of 3

pball
Mentor
Mentor

You can open a file in the background to access it's properties.

 

Dim invDoc As Document
    Set invDoc = ThisApplication.Documents.Open("c:\filename.ipt",false)
Check out my style edits for the Autodesk forums
pball's Autodesk Forum Style
0 Likes
Message 3 of 3

RasmusBredal
Advocate
Advocate

Hi pball

 

Thanks I had not through of this. 😉

Unfortunately, can Inventor not open ÁutoCAD dwg in the background.... 

 

Next step is how I get asses to the open dwg file properties..

The iLogic rule is running from a idw file. 

 

Have tried the following:

SyntaxEditor Code Snippet

Dim invDoc As Document 
    invDoc = ThisApplication.Documents.Open(oDWGFile, False) 
    
    'define the property set
    customPropertySet = invDoc.PropertySets.Item("Inventor User Defined Properties")
    Dim oSystem As String     
    Try 
oSystem = customPropertySet.Item("System")
Catch
End Try
 
0 Likes