Help regarding linking a drawing view to show specific positional representation

Help regarding linking a drawing view to show specific positional representation

sohaib.as01
Advocate Advocate
1,021 Views
2 Replies
Message 1 of 3

Help regarding linking a drawing view to show specific positional representation

sohaib.as01
Advocate
Advocate

Hello everyone,

I am having problem developing a piece of code for my drawing view where I can actively link my drawing view lets say "FRONT" view to one of the two positional representations I have in my main assembly model.

I have figured out a code to automatically change the pos reps of my assembly model using iLogic when certain parameter of my assembly is changed.

Now I also want my main drawing view which is "FRONT" view to check that same parameter using if statement and then activate the desired pos rep to reflect on the drawing. Thats the code I figured so far for my drawing but its not working, returning error "Unable to cast object of type 'Autodesk.iLogic.Runtime.CadDrawingView' to type 'Inventor.DrawingView'.

Thank you so very much for your help guys 🙂

Dim ViewF As DrawingView = ActiveSheet.View("FRONT")
If GoExcel.CellValue("Sheet LXJ.xlsx", "Sheet1", "J23") = 1 
ViewF.RepresentationsManager.SetPositionalRepresentation("1 LS", True)
Else If GoExcel.CellValue("Sheet LXJ.xlsx", "Sheet1", "J23") = 2
ViewF.RepresentationsManager.SetPositionalRepresentation("2 LS", True)
end if

 

 

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

J-Camper
Advisor
Advisor
Accepted solution

The DrawinView Object does not have a RepresentationManager Property.  You should be able to Get/Set the Positional Representation with the ActivePositionalRepresentation Property like this I believe:

 

Dim ViewF As DrawingView = ActiveSheet.View("FRONT").View
If GoExcel.CellValue("Sheet LXJ.xlsx", "Sheet1", "J23") = 1 
ViewF.ActivePositionalRepresentation = "1 LS"
Else If GoExcel.CellValue("Sheet LXJ.xlsx", "Sheet1", "J23") = 2
ViewF.ActivePositionalRepresentation = "2 LS"
End If

 

 

Message 3 of 3

sohaib.as01
Advocate
Advocate

Oh thanks buddy @J-Camper  , such a simple thing that was.

Thanks alot buddy , worked perfectly.

0 Likes