tralles Posted February 7, 2014 Share Posted February 7, 2014 hi, I've a problem. I want to make the polyline offset and would like to know the coordinates of the new polyline. I write codes, picked the polyline and offset that given distance but dont learn coordinates new poyline. please help. Quote Link to comment Share on other sites More sharing options...
Tyke Posted February 8, 2014 Share Posted February 8, 2014 In your VBA code declare a variable for your polyline and set it to your polyline. This polyline object then has an offset method which creates a new polyline object as a variant object. You can then list the coordinates of the new polyline object. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted February 9, 2014 Share Posted February 9, 2014 Here is a co-ords of pline I have changed the code to use last entity created. (defun getcoords (ent) (vlax-safearray->list (vlax-variant-value (vlax-get-property (vlax-ename->vla-object ent) "Coordinates" ) ) ) ) (defun co-ords2xy (I numb xy) ; convert now to a list of xy as co-ords are x y x y x y if 3d x y z x y z (setq numb (/ (length co-ords) 2)) (setq I 0) (repeat numb (setq xy (list (nth i co-ords)(nth (+ I 1) co-ords) )) (setq co-ordsxy (cons xy co-ordsxy)) (setq I (+ I 2)) ) ) ; program starts here ;(setq co-ords (getcoords (car (entsel "\nplease pick pline")))) (setq co-ords (getcoords (car (entlast)))) (co-ords2xy) Quote Link to comment Share on other sites More sharing options...
tralles Posted February 9, 2014 Author Share Posted February 9, 2014 thanks for all, i write that codes for review. first polyline cordinates ok. but i cant learn new polyline. I want draw third polyline between first polyline first vertex and second polyline last vertex Private Sub CommandButton1_Click() Dim basePnt As Variant Dim returnObj As AcadObject Dim distance As Double Dim vertexPts As Variant Dim numberofvertices As Long On Local Error GoTo err 'On Error Resume Next UserForm1.hide ThisDrawing.Utility.GetEntity returnObj, basePnt, "Select Polyline" distance = 50 'for example returnObj.Offset (distance) vertexPts = returnObj.Coordinates numberofvertices = UBound(vertexPts) + 1 For i = 0 To numberofvertices - 1 Step 2 MsgBox "" & vertexPts(i) & ", " & vertexPts(i + 1) Next i UserForm1.show Exit Sub err: If err.Number = -2147352567 Then UserForm1.show End If End Sub Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.