Author Topic: ssget filter for dimscale  (Read 2362 times)

0 Members and 1 Guest are viewing this topic.

diarmuid

  • Bull Frog
  • Posts: 417
ssget filter for dimscale
« 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
If you want to win something run the 100m, if you want to experience something run a marathon

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
ssget filter for dimscale
« Reply #1 on: September 13, 2004, 06:40:32 AM »
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.
Code: [Select]


(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)
TheSwamp.org  (serving the CAD community since 2003)

diarmuid

  • Bull Frog
  • Posts: 417
ssget filter for dimscale
« Reply #2 on: September 13, 2004, 07:36:29 AM »
thanks for the help Mark.
If you want to win something run the 100m, if you want to experience something run a marathon