• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Autodesk Inventor Engineer-to-Order

    Reply
    Contributor
    Posts: 22
    Registered: ‎05-31-2012

    set iProperties

    208 Views, 7 Replies
    08-16-2012 10:48 AM

    I'm trying to set the iProperties value Mass.  I'm using a placeholder block to cut down on the graphics load, but I still want the part to reflect the correct weight load and weight distribution.  I'm starting with the flollowing code:

     

    child block as :block, quantity = 4

        iProperties = {{"Mass", 8}}

    end child

     

    the value shows up here

     

    mass iprop intent browser.jpg

     

    but not here

     

    mass iprop physical iprops.JPG

     

    how do I pass the value through?

     

    Thanks,

    Andrew

    Please use plain text.
    Employee
    Posts: 7
    Registered: ‎10-31-2007

    Re: set iProperties

    08-16-2012 04:23 PM in reply to: alundr

    Not sure why this isn't working for mass properties. The same technique seems to for custom properties, e.g.

     iProperties = {{"test", 200.0}}

     

    Then a custom property is added:

     

    customprops.png

     

     

    Please use plain text.
    Employee
    AlexKorzun
    Posts: 71
    Registered: ‎11-10-2008

    Re: set iProperties

    08-17-2012 06:42 AM in reply to: alundr

    Hi,

     

    iProperties are stored in the Inventor document/file (IPT, in your case). If you switch to the ClientGraphics implementation of the block, there will not be a document behind it.

     

    You may consider adding the Parameter/Rule to keep the value of the mass.

    Thank you,

    Alex Korzun
    Principal Engineer
    Inventor Engineer-to-Order
    Please use plain text.
    Contributor
    Posts: 22
    Registered: ‎05-31-2012

    Re: set iProperties

    08-17-2012 07:05 AM in reply to: alundr

    I'm not sure what you mean by "adding the Parameter/Rule to keep the value of the mass".  

    What are ClientGraphics?

    Do you have an example of how I would go about doing this?  

    What do you mean by "keep the value of the mass"?

     

    Andrew

    Please use plain text.
    Employee
    AlexKorzun
    Posts: 71
    Registered: ‎11-10-2008

    Re: set iProperties

    08-17-2012 07:42 AM in reply to: alundr

    Create new Design that extends block:

    Design BlockWithMass : Block
    	Rule Density As Number = 10.0
    
    	Rule Mass As Number = Me.width*Me.height*Me.length*Density

    Parameter Rule Mass1 As Number = 0.0 End Design

     

    Create the child list in your assembly:

    Child block As :BlockWithMass , Quantity = 5
        width = child.index
        height = child.index
        length = child.index

        origin = Point( child.index*2, 0, 0)

        Mass1 = 8.0

    End Child

     

     

    Please note that Mass is a Rule (which is calculated from the block size), and Mass1 is a Parameter, that can be specified during creation of the BlockWithMass

     

    Mass of the block 3 will be determined as:

    Intent >block_3.mass
    --> 270.0
    Intent >block_3.mass1
    --> 8.0
    Intent >

     

     

    Thank you,

    Alex Korzun
    Principal Engineer
    Inventor Engineer-to-Order
    Please use plain text.
    Contributor
    Posts: 22
    Registered: ‎05-31-2012

    Re: set iProperties

    08-17-2012 11:29 AM in reply to: AlexKorzun

    what does the iv_setProperty method do/how does it function?

    Please use plain text.
    Employee
    AlexKorzun
    Posts: 71
    Registered: ‎11-10-2008

    Re: set iProperties

    08-17-2012 12:14 PM in reply to: alundr

    Hi,

     

    The first argument to the function iv_PropertyPut should be an Intent Part. The implementation tries to find the Inventor Document that owns the property. 

     

    In your case, Block will not have the Inventor Document behind it, so Intent will try to find the Document in Block's parent.

     

     

     

    Thank you,

    Alex Korzun
    Principal Engineer
    Inventor Engineer-to-Order
    Please use plain text.
    Employee
    Posts: 7
    Registered: ‎10-31-2007

    Re: set iProperties

    08-19-2012 12:52 PM in reply to: AlexKorzun

    If you're not able to set the mass using the default iProperties rule, as a workaround you can implement your own that calls the Inventor API, for example:

     

    Method UpdateMass(Mass As Number) As Boolean
     Try
      Dim invApp As Any=%%InventorApplication
      
      Dim activeDoc As Any=invApp.ActiveDocument

      If activeDoc<>NoValue Then
       
       If activeDoc.DocumentType=Inventor.DocumentTypeEnum.kPartDocumentObject Or _
             activeDoc.DocumentType=Inventor.DocumentTypeEnum.kAssemblyDocumentObject Then
             
        Dim massprops As Any=activeDoc.ComponentDefinition.MassProperties
        massprops.Mass=Mass
        
        Return True
       End If
      End If
      
      Return False
      
     Catch Error  
      Return False
     End Try
     
    End Method

    Please use plain text.