Ik gebruik nu dit:
(setq b (ssget))
Maar ik wil graag alléén gesloten plines gebruiken dus doe ik dit:
(setq b (ssget '((70 . 1)))) ;gesloten polyline: '((70 . 1))))
Maar dan selecteer ik alleen een gesloten polyline waar de linetype generation op "Disabled" staat --> '((70 . 129))
Hoe krijg ik het voor elkaar om zowel '((70 . 1)) en '((70 . 129)) te selecteren met (setq b (ssget))?
Citaat van: EddyBeerke op do 02 10 2008, 12:00:28
Ik gebruik nu dit:
(setq b (ssget))
Maar ik wil graag alléén gesloten plines gebruiken dus doe ik dit:
(setq b (ssget '((70 . 1)))) ;gesloten polyline: '((70 . 1))))
Maar dan selecteer ik alleen een gesloten polyline waar de linetype generation op "Disabled" staat --> '((70 . 129))
Hoe krijg ik het voor elkaar om zowel '((70 . 1)) en '((70 . 129)) te selecteren met (setq b (ssget))?
Beste EddyBeerke,
Met zoiets als:
(setq ss1 (ssget "X" '(
(-4 . "<OR")
(70 . 1)
(70 . 129)
(-4 . "OR>")
)
))
Zie in de AutoCAD Help voor
Grouping operators for selection set filter lists
Starting Ending
operator Encloses operator
"<AND" One or more operands "AND>"
"<OR" One or more operands "OR>"
"<XOR" Two operands "XOR>"
"<NOT" One operand "NOT>"
bij:
AutoLISP Developer's Guide> Using AutoLISP to Manipulate AutoCAD Objects
>Selection Set Handling > Selection Set Filter Lists > Logical Grouping of Filter Tests
Met vriendelijke groet, HofCAD CSI
Beste EddyBeerke,
Ook wel leuk en bruikbaar is:
;;;* SSTOOLS.LSP is a kit of selection set tools. Each returns SS3, a global.
;;;* SSUNION adds two selection sets using the SELECT command.
;;;* It must be used prior to the command which is to receive its selection.
;;;*
(defun ssunion (ss1 ss2 / hilite ss3)
(setq hilite (getvar "HIGHLIGHT")) ;Speeds up selection
(setvar "HIGHLIGHT" 0)
(command "_.SELECT" ss1 ss2 "") ;Combines sets using SELECT
(setq ss3 (ssget "P")) ;Combined set is the previous
(setvar "HIGHLIGHT" hilite)
ss3 ;Returns SS3
);defun
;;;*
;;;* SSDIFF subtracts ss2 from ss1 using the SELECT command
;;;* Like SSUNION, it cannot be used transparently
;;;*
(defun ssdiff (ss1 ss2 / hilite ss3)
(setq hilite (getvar "HIGHLIGHT")) ;Speeds up selection
(setvar "HIGHLIGHT" 0)
(command "_.SELECT" ss1 "_R" ss2 "") ;Uses the Remove mode of SELECT
(setq ss3 (ssget "P")) ;Combined set is the previous
(setvar "HIGHLIGHT" hilite)
ss3 ;Returns SS3
);defun
;;;*
;;;* SSINTER makes a set of the entities common to both SS1 and SS2
;;;* It uses only AutoLISP functions, so it can be used within a command
;;;*
(defun ssinter (ss1 ss2 / count count1 count2 smax smax1 smax2 more less name hilite ss3)
(setq count 0 ;Set counters
count1 0
count2 0
smax1 (sslength ss1) ;Get number of entities in sets
smax2 (sslength ss2)
ss3 (ssadd) ;Start a new empty set
);setq
(if (>= count1 count2) ;Find larger set
(setq more ss1 less ss2 smax smax1) ;Then flip set names around
(setq more ss2 less ss1 smax smax2) ;Else put larger first
);if
(while (< count smax) ;Start a program loop
(setq name (ssname more count)) ;Get the entity name
(if (ssmemb name less) ;See if it's in the other set
(ssadd name ss3) ;If so, add it to the output set
);if
(setq count (1+ count)) ;Increment counter
);while
ss3 ;Returns SS3
);defun
Met vriendelijke groet, HofCAD CSI
PS Voor nog meer mogelijkheden voor union zie http://www.theswamp.org/index.php?topic=24129.0
en subtract zie http://forums.augi.com/showthread.php?t=110916
PS Zie ook http://www.realerthanreal.com/autolisp/SetFunctions.lsp