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

IDW ilogic reference point error

Hi,

 

I have an issue with an .idw where im trying to work out a rule in iLogic that will scale my views depending on the length of a pipe that i have drawn. An example is that if the length is above 7000mm the scale is 1:55, and above 11000 the scale is 1:75 . 

I have four views, the 3 normal ISO standard views + a 3D.

the code i have now gives me the error: "Object reference not set to an instance of an object."

 

Im assuming its the .SetSpacingToCorner code that gives me the error, and this feature is not important, i just need them splitted apart. 

 

here is the code:

 

SyntaxEditor Code Snippet

If Parameter("15231.10:1", "Conveyor_Lenght")<=7000
ActiveSheet.View("VIEW1").Scale=1/45
ActiveSheet.View("VIEW3").Scale=1/55
ActiveSheet.View("VIEW5").Scale=1/55
ActiveSheet.View("VIEW1").SetSpacingToCorner(20, 80, SheetCorner.BottomLeft)
ActiveSheet.View("VIEW2").SetSpacingToCorner(230, 90, SheetCorner.BottomLeft)
ActiveSheet.View("VIEW3").SetSpacingToCorner(280, 40, SheetCorner.BottomLeft)
ActiveSheet.View("VIEW5").SetSpacingToCorner(280, 90, SheetCorner.BottomLeft)

Else If Parameter("15231.10:1", "Conveyor_Lenght")<=11000
ActiveSheet.View("VIEW1").Scale=1/65
ActiveSheet.View("VIEW3").Scale=1/75
ActiveSheet.View("VIEW5").Scale=1/65
ActiveSheet.View("VIEW1").SetSpacingToCorner(20, 80, SheetCorner.BottomLeft)
ActiveSheet.View("VIEW2").SetSpacingToCorner(230, 90, SheetCorner.BottomLeft)
ActiveSheet.View("VIEW3").SetSpacingToCorner(280, 40, SheetCorner.BottomLeft)
ActiveSheet.View("VIEW5").SetSpacingToCorner(280, 90, SheetCorner.BottomLeft)

Else If Parameter("15231.10:1", "Conveyor_Lenght")<=15000
ActiveSheet.View("VIEW1").Scale=1/85
ActiveSheet.View("VIEW3").Scale=1/95
ActiveSheet.View("VIEW5").Scale=1/85
ActiveSheet.View("VIEW1").SetSpacingToCorner(20, 80, SheetCorner.BottomLeft)
ActiveSheet.View("VIEW2").SetSpacingToCorner(230, 90, SheetCorner.BottomLeft)
ActiveSheet.View("VIEW3").SetSpacingToCorner(280, 40, SheetCorner.BottomLeft)
ActiveSheet.View("VIEW5").SetSpacingToCorner(280, 90, SheetCorner.BottomLeft)

End If

    ' Set a reference to the active drawing document
    Dim oDoc As DrawingDocument
 oDoc = ThisDoc.Document


    ' Set a reference to the active sheet
    Dim oSheet As Sheet
 oSheet = oDoc.ActiveSheet

    Dim oDrawingDim As DrawingDimension

    ' Iterate over all dimensions in the drawing and
    ' center them if they are linear or angular.

    For Each oDrawingDim In oSheet.DrawingDimensions
        If TypeOf oDrawingDim Is LinearGeneralDimension Or _
           TypeOf oDrawingDim Is AngularGeneralDimension Then
        oDrawingDim.CenterText
        End If
    Next

InventorVb.DocumentUpdate() 

 Any help?

 

Thank you in advance. 

 

-A