View position

View position

anavazquez5LRNJ
Enthusiast Enthusiast
424 Views
5 Replies
Message 1 of 6

View position

anavazquez5LRNJ
Enthusiast
Enthusiast

I have been trying to automate some drawings, in the forum I found a code that gives the position of the view, but apparently the coordinate (0,0) is the center of the view, my question is, is it possible to have the position of the lower left corner of the view with respect to the sheet and know the size of the view that is on the sheet?

 

   Dim oDoc As DrawingDocument
     oDoc = ThisApplication.ActiveDocument
    
    Dim oView As DrawingView
    oView = oDoc.Sheets(3).DrawingViews(1)
    
    Dim oPosition As Point2d
     oPosition = oView.Position 
    MessageBox.Show(“PosX:” & oPosition.X/2.54 & “, PosY: “ & oPosition.Y/2.54)

 

0 Likes
425 Views
5 Replies
Replies (5)
Message 2 of 6

WCrihfield
Mentor
Mentor

Yes.

Dim oDoc As DrawingDocument
oDoc = ThisApplication.ActiveDocument

Dim oView As DrawingView
oView = oDoc.Sheets(3).DrawingViews(1)

MsgBox("View Size = " & oView.Width & " cm Wide x " & oView.Height & " cm Tall" _
& vbCrLf & "View Lower Left Corner = " & (oView.Left) & " x " & (oView.Top - oView.Height),vbInformation, "iLogic")

If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 6

anavazquez5LRNJ
Enthusiast
Enthusiast

Hi @WCrihfield  , thank you very much, one last question, is it also possible to get the positions of the occurrences found in a view?

0 Likes
Message 4 of 6

WCrihfield
Mentor
Mentor

Are you talking about assembly components within a drawing view of an assembly?  If so, then each assembly component within that view will likely have multiple drawing curve objects (individual lines, arcs, and similar) within the drawing view, and each entity can potentially have multiple 'positions', such as start point, mid point, end point, center point, and so on.  I am not sure what 'position' you would want for any given assembly component.  If you are not talking about assembly components, then please explain what type of components you mean.  And what would you want to do with this information (just show positional data in a message?) ?

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 5 of 6

anavazquez5LRNJ
Enthusiast
Enthusiast

 Hi @WCrihfield ,

Yes, I am talking about assembly components inside a drawing view of an assembly, I needed the position of the occurrence (but I was thinking about the "complete" occurrences to obtain a single "absolute" position of each occurrence without taking into account the components they carry) inside the view of a drawing of an assembly and with this devise a formula to obtain the sides of the view (right, left, top and bottom), In my case my view is an assembly with a rectangular shape (not always has the same amount of occurrences or measures the same but the shape is always the same (rectangular)) to which I want to place dimensions automatically and it would facilitate me a lot to know on which side is the occurrence within the assembly to give value to the dimension.

I have a rule to "solve" this problem and insert instanceproperty to the subassemblies of the assembly but when new ones are added the sequence is lost because it depends on how they are ordered in the model browser so I wanted to try to do what I mentioned above.

0 Likes
Message 6 of 6

bradeneuropeArthur
Mentor
Mentor
You could try rangebox and then min and max position of the view.
I will test it later. I am far from my desk at the moment.

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes