AddLine Method

Back to Methods Reference

Creates a line passing through two points.

Signature :

VBA : RetVal = object.AddLine(StartPoint, EndPoint)

VL : RetVal = vla-AddLine Object StartPoint EndPoint

(setq aLine (vla-AddLine mSpace pt1 pt2))

  • Object : ModelSpace Collection, PaperSpace Collection, Block
    The object or objects this method applies to.

  • StartPoint : Variant (three-element array of doubles); input-only
    The 3D WCS coordinates specifying the line start point.

  • EndPoint : Variant (three-element array of doubles); input-only
    The 3D WCS coordinates specifying the line endpoint.

  • RetVal : Line object
    The newly created Line object.

Example :

(defun c:al-addline ()

(vl-load-com)

(setq thisdrawing (vla-get-activedocument (vlax-get-acad-object)))

(setq mspace (vla-get-modelspace thisdrawing))

(setq PT1 (getpoint "\nSpecify First Point: "))

(setq PT2 (getpoint "\nSpecify next point: " PT1))

(setq myline (vla-addline mspace (vlax-3d-point PT1)(vlax-3d-point PT2)))

(princ)

);defun

(princ)

;-------------------------------

;alternative method

(defun c:al-addline1 ()

(vl-load-com)

(setq thisdrawing (vla-get-activedocument (vlax-get-acad-object)))

(setq mspace (vla-get-modelspace thisdrawing))

(setq util (vla-get-utility thisdrawing))

(setq PT1 (vla-getpoint util nil "\nSpecify First Point : "))

(setq PT2 (vla-getpoint util PT1 "\nSpecify Second Point : "))

(setq myline (vla-addline mspace PT1 PT2))

(princ)

);defun

(princ)

;---------------------------
 
The AutoLisp/Visual Lisp/VBA Resource Website
Google
Search the WWW Search AfraLisp

Copyright © 1999-Perpetuity by AfraLisp

All rights reserved.
Information in this document is subject to change without notice.
Site created and maintained by Kenny Ramage

The AutoLisp/Visual Lisp/VBA Resource Website