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

@bradeneuropeArthur

 

Sure, below is the code for the same.

 

Function CreateCLine(Sht As Sheet, dv As DrawingView, occ As Object, AxisName As String) As Centerline
        Dim docDesc As DocumentDescriptor = dv.ReferencedDocumentDescriptor
        Dim Doctype As DocumentTypeEnum = docDesc.ReferencedDocumentType
        
        'get objects
        If Doctype = DocumentTypeEnum.kPartDocumentObject
            includeObj = occ.Definition.WorkAxes(AxisName)
        Else    ''assembly, so GET PROXY OF OCCURRENCE
            includeObj = ASI_.getWorkAxisProxy(occ, AxisName)
        End If
	DIm oCMStatus as Boolean
	oCMStatus = false 
	Dim oCLStatus as Boolean 
	oCLStatus = false
	
	DIm cmCnt as integer 
	cmCnt = Sht.CenterMarks.Count
	Dim clCnt as integer 
	clCnt = Sht.Centerlines.Count
        
        'includes objects
        dv.SetIncludeStatus(includeObj, True)
	
	If Sht.Centermarks.Count > cmCnt Then
		oCMStatus = True		
	Else If Sht.Centerlines.Count > clCnt Then
		oCLStatus = True
	End If
        
        ''find centerline that was just created
        Dim newCL As Centerline
        For Each CL As Centerline In Sht.Centerlines
            If CL.ModelWorkFeature Is includeObj
                newCL = CL
                Exit For
            End If
        Next
        Return newCL
    End Function

Thanks and regards, 

 


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network