xline

Discussion in 'AutoCAD' started by Clive, Aug 15, 2003.

  1. Clive

    Clive Guest

    Anybody have sample code for xline
    IE Pick a point and per to a Vlax-curve-object.

    Regards


    Clive.

    To all in this group. Thanks
     
    Clive, Aug 15, 2003
    #1
  2. Clive

    Joe Burke Guest

    Clive,

    This proved a bit more complicated than I expected. But I think it works.

    (defun c:perXline ( / vobj p1 p2)
    (setq vobj (vlax-ename->vla-object
    (car (entsel "Select object: "))))
    (setq p2 (getpoint "\nPick point: "))
    (setq p1 (vlax-curve-getClosestPointTo vobj p2))
    (entmake
    (list
    '(0 . "XLINE")
    '(100 . "AcDbEntity")
    '(100 . "AcDbXline")
    (cons 10 p1)
    (cons 11 (mapcar '- p2 p1))
    )
    )
    (princ)
    )

    Note, the 11 code of an xline is a vector.

    Joe Burke
     
    Joe Burke, Aug 17, 2003
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
Loading...