Inventor Drawing Sheet - view scale

Inventor Drawing Sheet - view scale

syafiqfarhan
Enthusiast Enthusiast
1,086 Views
4 Replies
Message 1 of 5

Inventor Drawing Sheet - view scale

syafiqfarhan
Enthusiast
Enthusiast

Hi, 

Is that possible to make this scale view on for the active sheet?

 

Dim oDrawDoc As DrawingDocument = ThisDrawing.Document
Dim oSheet As Sheet
Dim oSheets As Sheets
Dim oView As DrawingView
Dim oViews As DrawingViews
Dim oScale As Double

oScale = InputBox("Enter Desired Scale", "Scaler", "1")

oSheets = oDrawDoc.Sheets
For Each oSheet In oSheets
   oViews = oSheet.DrawingViews
   For Each oView In oViews	
       If oView.ScaleFromBase = False Then
           oView.Scale = oScale
       End If
   Next
Next

 

0 Likes
Accepted solutions (1)
1,087 Views
4 Replies
Replies (4)
Message 2 of 5

A.Acheson
Mentor
Mentor

Here is a link to API help for ActiveSheet property and syntax. Just remove the loop through the sheets and on the active sheet loop through the views. 

Dim oSheet As Sheet = oDrawDoc.ActiveSheet
oViews = oSheet.DrawingViews

For Each oView In oViews
If oView.ScaleFromBase = False Then
oView.Scale = oScale
End If

Next

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 3 of 5

syafiqfarhan
Enthusiast
Enthusiast

@A.Acheson I had tried to remove the loop but I show an error. Please share full code here, so I can check where is my mistake. Thanks!

0 Likes
Message 4 of 5

A.Acheson
Mentor
Mentor
Accepted solution

Here you go. Error were likely declarations in the wrong place. Hopefully you can check this tested one to see where it went wrong. 

 

Dim oDrawDoc As DrawingDocument = ThisDrawing.Document
Dim oSheet As Sheet
Dim oSheets As Sheets
Dim oView As DrawingView
Dim oViews As DrawingViews
Dim oScale As Double

oScale = InputBox("Enter Desired Scale", "Scaler", "1")

oSheet = oDrawDoc.ActiveSheet
oViews = oSheet.DrawingViews

For Each oView In oViews	
   If oView.ScaleFromBase = False Then
       oView.Scale = oScale
   End If
Next

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 5 of 5

syafiqfarhan
Enthusiast
Enthusiast

@A.Acheson This time working fine. Only 1 sheet change the scale. Thanks a lot. 

0 Likes