• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

object selection with visual lisp

  • Thread starter Thread starter Cristallo
  • Start date Start date

Cristallo

Guest
in lisp (not visual) I can get the name of the entity or its complete list via
(setq name_entita (car (entsel)))
(setq entita (entget (entsel))))

the same information, via visual lisp how do you get it?
 
(setq name_entita (car (entsel)))

(setq vlaobj (vlax-ename->vla-object name_entita)) get the object (equal to entity), you still do not know what it is, line, pline, etc.

(vlax-get-property vlaobj 'objectname) type entity

(fnvarianttolisp (vlax-get-property vlaobj "startpoint")) if it were a line returns the same list (cdr (assoc 10 entities))

================================================================================================================================================================================================================================================================
this small function reports the properties of the selected entity
; what is it?
(defunc c:cce()
(setq n (car (sing))
(setq vlaobj (vlax-ename->vla-object n))
(vlax-dump-object vlaobj)
)
================================================================================================================================================================================================================================================================
; turns variable variant type into lists
(defun fnvarianttolisp(var)
(cond)
(= (type var) 'variant)
(vlax-variant-value var))
((=type var) 'safearray'
(mapcar 'fnvarianttolisp (vlax-safearray-> var))
)
(T var)
)
================================================================================================================================================================================================================================================================

is just the beginning, on the net you find a lot of material.
 
kill, a bit more complicated than dry lisp, although I saw that you can get more targeted functions (like intersection of a straight with a beads, a distance on a curve etc)
 
commands added with vl-load-com use the same logic as vba, so objects with properties and methods, learn one and understand the other.
Hi.
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top