« CADopia - AddPolyfaceMesh method | Main | CADopia - AddPViewport method »

Thursday, December 06, 2007

CADopia - AddPolyline method

Creates a polyline and adds it to the drawing.

Syntax

objectVariable = object.AddPolyline(Vertices)

Where:

     object is one of the ModelSpace or PaperSpace collection objects or a Block object;

     Vertices are a series of Point objects specifying coordinate locations for each polyline vertex.

AddPolyline method example

Private Sub Polyline_Example()

' This example adds a polyline to the drawing using the AddPolyline method.

     Dim myDoc As CADopia.Document

     Dim myPline As Polyline

     Dim myPoints As points

     Dim pt As Point

     Set myDoc = ActiveDocument

     Set myPoints = Library.CreatePoints

     Set pt = Library.CreatePoint(1, 1, 0)

     myPoints.Add

     myPoints(myPoints.Count).x = pt.x

     myPoints(myPoints.Count).y = pt.y

     myPoints(myPoints.Count).z = pt.z

     Set pt = Library.CreatePoint(3, 3, 0)

     myPoints.Add

     myPoints(myPoints.Count).x = pt.x

     myPoints(myPoints.Count).y = pt.y

     myPoints(myPoints.Count).z = pt.z

     Set myPline = ThisDocument.ModelSpace.AddPolyline(myPoints)

     myPline.Update

     ThisDocument.ActiveViewport.ZoomExtents

End Sub

Comments

Post a comment

If you have a TypeKey or TypePad account, please Sign In