Specified case is not valid when drawing lines in a drawing

Specified case is not valid when drawing lines in a drawing

j_span755F8
Contributor Contributor
156 Views
1 Reply
Message 1 of 2

Specified case is not valid when drawing lines in a drawing

j_span755F8
Contributor
Contributor

Hi there,

 

Im trying to draw a line in a drawing using iLogic,

I've simplified the end result in this:

 

' Create a new rule named "CreateLineBetweenPoints"
Sub Main()
    ' Declare variables for point coordinates
    Dim pointA(2) As Double
    Dim pointB(2) As Double
    
    ' Set the coordinates for point A (adjust as needed)
    pointA(0) = 5 ' X coordinate
    pointA(1) = 5 ' Y coordinate
    pointA(2) = 5 ' Z coordinate
    
    ' Set the coordinates for point B (adjust as needed)
    pointB(0) = 10 ' X coordinate
    pointB(1) = 20  ' Y coordinate
    pointB(2) = 10  ' Z coordinate
    
    ' Get the active drawing document
    Dim drawingDoc As DrawingDocument
    drawingDoc = ThisApplication.ActiveDocument
    
    ' Get the active sheet
    Dim sheet As Sheet
    sheet = drawingDoc.ActiveSheet
    
    ' Get the active view (assuming it's a base view)
    Dim baseView As DrawingView
    baseView = sheet.DrawingViews.Item(1) ' Assuming the base view is the first item
    
    ' Get the sketch associated with the base view
    Dim sketch As Sketch
    sketch = baseView.Sketches.Add
    
    ' Add the line to the sketch between point A and point B
    Dim line As SketchLine
    line = sketch.SketchLines.AddByTwoPoints(pointA, pointB)
End Sub

It gives the error on line35, case not specified, 

 

0 Likes
157 Views
1 Reply
Reply (1)
Message 2 of 2

Michael.Navara
Advisor
Advisor

SketchLines.AddByTwoPoints Method requires aruments of type Point2D or SketchPoint. Not array of double.

See this sample for more information

0 Likes