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

iLogic script to calculate number of specific kCustomLineType

mallorn
Advocate

iLogic script to calculate number of specific kCustomLineType

mallorn
Advocate
Advocate

Hello,

 

Is there a chance to calculate, in the sketch, number of curves with a special line type i.e.: "ACAD_ISO02W100"?

 

In the below iLogic script I'm able to calculate all the curves with "kCustomLineType", but I need to know how many lines are with above given type...

Dim oDoc As Document = ThisApplication.ActiveDocument
Dim oSketch As Sketch
oSketch = oDoc.ComponentDefinition.Sketches.Item(1)

'Dim linesCount As Integer 
linesCount = 0 ' ******* must be a parameter *******

Dim i As Double
    For i = 1 To oSketch.SketchLines.Count
        If oSketch.SketchLines.Item(i).LineType.ToString = "kCustomLineType" ' "ACAD_ISO02W100" needed
            linesCount = linesCount + 1
        End If
    Next i

 

-------------------------
Tomasz Malinowski
0 Likes
Reply
Accepted solutions (1)
539 Views
3 Replies
Replies (3)

chandra.shekar.g
Autodesk Support
Autodesk Support

@mallorn,

 

Can you please provide Inventor file which contains custom line (ACAD_ISO02W100) to test?

 

Please make sure that files are non confidential.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes

mallorn
Advocate
Advocate

No problem,

You can get the custom line types directly from Inventor standard database also (right clicking on curve properties):

ACAD_ISO02W100.png

-------------------------
Tomasz Malinowski
0 Likes

chandra.shekar.g
Autodesk Support
Autodesk Support
Accepted solution

@mallorn,

 

Try below iLogic code to count number of custom line type ("ACAD_ISO02W100").

 

Dim oDoc As Document = ThisApplication.ActiveDocument
Dim oSketch As Sketch
oSketch = oDoc.ComponentDefinition.Sketches.Item(1)

'Dim linesCount As Integer 
linesCount = 0 ' ******* must be a parameter *******
Dim oName As String 
Dim oDesc As String
Dim i As Double
For i = 1 To oSketch.SketchLines.Count
    If oSketch.SketchLines.Item(i).LineType.ToString = "kCustomLineType" ' "ACAD_ISO02W100" needed
	   
	   Call oSketch.SketchLines.Item(i).GetCustomLineType(oName, oDesc)
	   
	   If oName = "ACAD_ISO02W100" Then
	   		linesCount = linesCount + 1
	   End If  		   
    End If
Next i

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes