Hide Table of Contents
ICreateLine2 Method (IModelDoc2)

Creates a sketch line in the currently active 2D or 3D sketch.

.NET Syntax

Visual Basic (Declaration) 
Function ICreateLine2( _
   ByVal P1x As System.Double, _
   ByVal P1y As System.Double, _
   ByVal P1z As System.Double, _
   ByVal P2x As System.Double, _
   ByVal P2y As System.Double, _
   ByVal P2z As System.Double _
) As SketchSegment
Visual Basic (Usage) 
Dim instance As IModelDoc2
Dim P1x As System.Double
Dim P1y As System.Double
Dim P1z As System.Double
Dim P2x As System.Double
Dim P2y As System.Double
Dim P2z As System.Double
Dim value As SketchSegment
 
value = instance.ICreateLine2(P1x, P1y, P1z, P2x, P2y, P2z)
C# 
SketchSegment ICreateLine2( 
   System.double P1x,
   System.double P1y,
   System.double P1z,
   System.double P2x,
   System.double P2y,
   System.double P2z
)
C++/CLI 
SketchSegment^ ICreateLine2( 
&   System.double P1x,
&   System.double P1y,
&   System.double P1z,
&   System.double P2x,
&   System.double P2y,
&   System.double P2z
) 

Parameters

P1x

X value of the line start point

P1y
Y value of the line start point
P1z

Z value of the line start point

P2x

X value of the line end point

P2y

Y value of the line end point

P2z

Z value of the line end point

Return Value

Newly created ISketchSegment object; if the operation fails, then NULL is returned

Remarks

If a sketch is not active, then the line is not created and NULL is returned. You can check for an active sketch using IModelDoc2::GetActiveSketch2 or IModelDoc2::IGetActiveSketch2.

For COM applications, the underlying ISketchLine object can be obtained using QueryInterface on the ISketchSegment object returned. C++ Dispatch applications can define a new ISketchLine or ISketchSegment object that uses this Dispatch pointer. Visual Basic applications interpret the pointer for you automatically so you can use the returned object to call ISketchSegment or ISketchLine functions.

IModelDoc2::SetAddToDB and IModelDoc2::SetDisplayWhenAdded increase performance during entity creation by adding entities directly to the SOLIDWORKS database. IModelDoc2::SetAddToDB also avoids inferencing.

When this method is used with a drawing document, this method creates the line relative to the active drawing view, IDrawingDoc::ActiveDrawingView or IDrawingDoc::IActiveDrawingView.

 

See Also

Availability

SOLIDWORKS 2001Plus FCS, Revision 10.0


Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

 
*Email:  
Subject:   Feedback on Help Topics
Page:   ICreateLine2 Method (IModelDoc2)
*Comment:  
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:



x

We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again
x

Web Help Content Version: API Help (English only) 2017 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.