Rename Positional Representations

Rename Positional Representations

Brett.G
Enthusiast Enthusiast
572 Views
2 Replies
Message 1 of 3

Rename Positional Representations

Brett.G
Enthusiast
Enthusiast

Is it possible to rename positional representations through the API?  I've tried setting the name as PosRep.name = "Test" but the method fails.

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

Owner2229
Advisor
Advisor
Accepted solution

Something like this? Remember, you can't rename the "Main" representation.

 

Dim oDoc As Inventor.Document = ThisApplication.ActiveDocument
Dim oCD As ComponentDefinition = oDoc.ComponentDefinition
Dim oPR As PositionalRepresentation = oCD.RepresentationsManager.PositionalRepresentations("OldName")
oPR.Name = "NewName"
Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
0 Likes
Message 3 of 3

Brett.G
Enthusiast
Enthusiast

Mike,

    Thanks for the reply, what you wrote out is essentially what I was doing in my code.  My issue was that I was trying to rename a positional representation with a name that was already in use. Oops!  

0 Likes