Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Delete User Parameters

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
386 Views, 2 Replies

Delete User Parameters

Is there any way to delete a user parameter using the API?  I had
expected there to be a Delete method on a UserParameter object, but there
isn't.




Brian R.
Iwaskewycz

Senior Mechanical Engineer
PA Transformer
Technology, Inc.
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Anonymous

Public oProp4 As
PropertySet

 

    ' User Defined
Properties
    Set oProp4 =
oPart.PropertySets("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}")

 

 

 

    If oProp4(1).Name
<> "Finish" Or oProp4(2).Name <> "MAT'L CODE" Or oProp4(3).Name
<> "MATERIAL" Or oProp4(4).Name <> "SUB NO." Or oProp4(5).Name
<> "MFG CODE" Or oProp4(6).Name <> "RSP" Or oProp4(7).Name <>
"RefPart" Then
        For Each oPropNew
In oProp4
           
oProp4(1).Delete
        Next

 

 

This routine checks for a specific
bunch of defined peoperties to be present in a certain order (though Inventor
lists alpgabetically, the sequence is whatever it is).  If they are not
there, it deletes them, one by one in the for-each statement.  Later in the
program, they are re-added.  Prior to deleting, the existing values can be
saved as variables ard re-used at re-creation time if desired.  Hope this
helps!

 

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">

Is there any way to delete a user parameter using the API?  I had
expected there to be a Delete method on a UserParameter object, but there
isn't.




Brian R.
Iwaskewycz

Senior Mechanical Engineer
PA
Transformer Technology, Inc.
Message 3 of 3
Anonymous
in reply to: Anonymous

That deletes properties - it's deleting user parameters that
I'm after, i.e.,

 

<document object>.ComponentDefinition.Parameters.UserParameters

 

It's those I can't delete.

 

I've written a routine that allows a linked workbook to be replaced with
another with any starting cell.  Inventor has the built-in ability to
Change Source, but Inventor always uses cell A1 as the starting cell for the new
workbook.  The workflow in pseudo-code is:

 

1) Delete the workbook link.  The parameters become user
parameters.

2) Rename the previously linked parameters with temporary names and
remember what each variable was renamed to.

3) Link up a new workbook at cell XX.

4) Look through the model parameters to find occurrences of the temporary
variable names and replace them with the original names (which are once again
linked).

5) Delete the temporary variables from the user parameters, because they
are unused and unnecessary.

 

Of course, it's step 5 above that I can't do.

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">

Public oProp4 As
PropertySet

 

    ' User Defined
Properties
    Set oProp4 =
oPart.PropertySets("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}")

 

 

 

    If
oProp4(1).Name <> "Finish" Or oProp4(2).Name <> "MAT'L CODE" Or
oProp4(3).Name <> "MATERIAL" Or oProp4(4).Name <> "SUB NO." Or
oProp4(5).Name <> "MFG CODE" Or oProp4(6).Name <> "RSP" Or
oProp4(7).Name <> "RefPart"
Then
        For Each oPropNew In
oProp4
           
oProp4(1).Delete
       
Next

 

 

This routine checks for a specific
bunch of defined peoperties to be present in a certain order (though Inventor
lists alpgabetically, the sequence is whatever it is).  If they are not
there, it deletes them, one by one in the for-each statement.  Later in
the program, they are re-added.  Prior to deleting, the existing values
can be saved as variables ard re-used at re-creation time if desired. 
Hope this helps!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report