TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: diarmuid on September 13, 2004, 04:20:13 AM
-
o.k. i've tried to crack this on my own but i've not had much luck. so here i am again, cap in hand.
using the ssget function in a lisp routine i want to select dimensions by their individual dimscale.
below is similar to what i'm looking for, but instead i want to select dimensions by particular dimscales.
(setq ssleader (ssget "x" ' ((0 . "leader"))))
(command "-layer" "make" "leader" "c" "2" "" "")
(setq sslayer (getvar "clayer"))
(command "_change" ssleader "" "properties" "layer" sslayer "")
)
from what i gather from the tutoring i'm getting from various web sites this is kinda the limit of my lisping.
any help would be greatly appreciated.
Regards
Diarmuid
*MST* changed the Subject of this thread
-
The dimscale for the leader is contained in it's xdata. I'm not sure you can even filter for that so I used the activex approach.
(vl-load-com)
(command "-layer" "make" "leader" "c" "2" "" "")
(setq dscale (getreal "\nEnter DIMSCALE to filter: "))
; create a selection set of all the leaders in the dwg
(setq ss (ssget "_X" ' ((0 . "LEADER")))
cntr 0
)
; iterate through each entity in the selection set
; converting it to a vla-object
(repeat (sslength ss)
; convert entity to object for activex use
(setq obj
(vlax-ename->vla-object
(ssname ss cntr)
)
)
; get the scalefactor of the object for comparison
(setq dsf (vla-get-scalefactor obj))
; if the objects dimscale matches that entered by the user
; then change the objects layer to 'leader'
(if (= dsf dscale)
(progn
(vlax-put-property obj 'Layer "leader")
(vlax-release-object obj)
)
)
(setq cntr (1+ cntr))
); repeat
(setq ss nil)
-
thanks for the help Mark.