Emulating fence (as in selection)

Emulating fence (as in selection)

john.uhden
Mentor Mentor
676 Views
1 Reply
Message 1 of 2

Emulating fence (as in selection)

john.uhden
Mentor
Mentor

I am trying to emulate the behavior and appearance of the fence option as in selecting objects, while at the same time creating a polyline for my TrimDim routine.

 

Here's what mostly works, but I forget how to make a rubberband vector look highlighted.

Is there some sysvar?

 

(defun c:fence ( / Mspace getp 2d p plist obj)
    (setq Mspace (vlax-get (vlax-get (vlax-get-acad-object) 'Activedocument) 'Modelspace))
    (defun getp (p)
      (if p
        (getpoint p "\nNext fence point: ")
        (getpoint "\nFirst fence point: ")
      )
    )
    (defun 2d (p)(list (car p)(cadr p)))
    (while (setq p (getp p))
      (setq plist (reverse (cons (2d p) (reverse plist))))
      (cond
        ((< (length plist) 2))
        ((= (length plist) 2)
          (setq obj (vlax-invoke Mspace 'AddLightweightPolyline (apply 'append plist)))
          (vla-highlight obj 1)
        )
        (obj
          (vlax-put obj 'coordinates (apply 'append plist))
          (vla-highlight obj 1)
        )
        ((princ "\nSomething is awry."))
      )
    )
    (princ)
 )

John F. Uhden

677 Views
1 Reply
Reply (1)
Message 2 of 2

john.uhden
Mentor
Mentor

@john.uhden wrote, "I forget how to make a rubberband vector look highlighted."

 

(initget 32) before (getpoint)

John F. Uhden

0 Likes