Inventor Customization

Reply
Mentor
Posts: 212
Registered: ‎04-20-2012
Message 1 of 2 (112 Views)
Accepted Solution

Preserv Functions in Iproperties when accessing them with a VBA script

112 Views, 1 Replies
12-03-2012 10:20 AM

I made a simple dialog to access some of the iproperties. This is quite handy when working on a drawing of a part, but there is one flaw with this script. If the part's description has a function referencing the parts dimensions for instance, when my script gets the description it gets the plain text and not the formula. Meaning if the part's description is "=<d0> X <d1> X <d2>" and appears as "1 X 2 X 3" the script will get "1 X 2 X 3" and when it resaves the description it will over write the formula with plain text.

 

Is it possible to get the formula so my script could display that for editing instead of the plain text?

 

Below is a part of the code I'm using and it's the standard code I've seen for retreiving ipropterties.

 

    Dim invDoc As Document
    Set invDoc = ThisApplication.Documents.ItemByName(GetToken(PartList.Value, 3, Chr(1)))
    
    Dim invDesignInfo As PropertySet
    Set invDesignInfo = invDoc.PropertySets.Item("Design Tracking Properties")
    
    Dim invProperty(1 To 4) As Property
    
    Set invProperty(1) = invDesignInfo.Item("Part Number")
    partnumber.Value = invProperty(1).Value
    
    Set invProperty(2) = invDesignInfo.Item("Description")
    description.Value = invProperty(2).Value

 

ADN Support Specialist
Posts: 421
Registered: ‎08-14-2012
Message 2 of 2 (106 Views)

Re: Preserv Functions in Iproperties when accessing them with a VBA script

12-04-2012 02:30 AM in reply to: pball

Inventor.Property.Expression returns formula.

You may create Expression programmatically as well.


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube