Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
matthew.johnson200
926 Views, 8 Replies

Using ilogic to check scales are the same on a sheet.

As we use a laser cutter to produce our parts, its important that all the parts on each sheet are at the same scale. I have been trying to come up with a code which checks all the views against the first view and flags up an error message if there are any parts different. I had a code working fine, but it only checked all scales against the first part scale on the first sheet. As some of our drawings have multiple sheets, with different scales per sheet, i would like it to check each view against the view on the sheet it is on. e.g. sheet 1 should be all be at 1:1, sheet 2 should all be at 1:2. One problem is that the amount of sheets may vary, and also the names are not set, so i cant specify each sheet in the code specifically.

 

So far i have this, but it doesn't seem to work. 

 

Any help will be greatly appreciated.

 

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
Dim oFView As String

oSheets = oDrawDoc.Sheets
oViews = oSheet.DrawingViews
For Each oSheet In oSheets
oFView = oDrawDoc.oSheet.DrawingViews(1).Name 'adds the NAME of the first view in sheet to oFView
oScale = oSheet.View(oFView).Scale 'sets the SCALE of the first view to OScale
For Each oView In oViews
If (oView.Scale = oScale) = False Then
MessageBox.Show("Some drawing views are not the same scale", "Check Scales")
End If
Next
Next

 

Tags (1)