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

dynamic blocks: selection via ssget "_w"

  • Thread starter Thread starter Vincenzo_O
  • Start date Start date

Vincenzo_O

Guest
Bye to all,
I am a neophyte of the lisp so take patience.
I am trying to run a routine that selects a dynamic block placed at a specific point of paper space and immects the current value of the block in a variable.
below the code that I modified starting from that of lee mac. does not work and I do not understand why.
every help is well accepted, thank you.


(defun lm:getdynpropvalue (blk prp )
(setq prp (strcase prp)
(vl-some '(lambda ( x ) (if (= prp (strcase (vla-get-propertyname x)))) (vlax-get x 'value)))
(vlax-invoke blk 'getdynamicblockproperties)
)
)

(defun c:02test ( / and x )

(setq ppp (getpoint "\n\tpick higher left corner\t [bleep]: ")

(setq x (nth 0 ppp)
(setq y (nth 1 ppp)

(setq x1 (+ x 20.72))
(setq y1 (- y 9.37)

(setq x2 (+ x 3.3))
(setq y2 (- y 7.85)

(if (and (setq and (ssget "_w" (list x1 y1))
(= "insert" (cdr (assoc 0)))
)
(print (setq x (lm:getdynpropvalue)
)
(princ)
)
 
the syntax to extract an object from an object gruppo di sThe election is as follows: (ssname gs indice), where index is a whole number that distinguishes the elements, the first element is zero.

therefore (ssname gs 0) returns the first item of the group, (ssname gs 3) returns the fourth.

in your case this change to code (setq e (ssname (ssget "_w" (list x1 y1) (list x2 y2)) 0))returns the name of the first object of the selection group, but a problem could arise in case "captured" objects were more than one.to verify the number of objects in a selection group is used (Slength GS)
 
grazie mille gp.

I modified it il codice tenendo conto delle tue indicazioni e chiarimenti. tutto ok adesso.
buone feste a tutti.

(defun lm:getdynpropvalue ( blk prp )
(setq prp (strcase prp)
(vl-some '(lambda ( x ) (if (= prp (strcase (vla-get-propertyname x))))
(vlax-invoke blk 'getdynamicblockproperties')
)
)

(defun c:02test ( / e x )
(vl-load-com)

(setq ppp (getpoint "\n\t***\tpick higher left corner\t*** \n : ")))

(setq x (nth 0 ppp))
(setq y (nth 1 ppp))

(setq x1 (+ x 22.32))
(setq y1 (- y 9.6)

(setq x2 (+ x 3.3))
(setq y2 (- y 7.5))

(setq selection (ssget "_w" (list x1 y1))
(setq ent(ssname selection 0))
(setq vl-obj ent)
(setq valore (cdr (assoc 0)))
(setq xx (lm:getdynpropvalue (vlax-ename->vla-object vl-obj) "fornitore"))

(princ)
)
 

Forum statistics

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

Members online

No members online now.
Back
Top