Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

lselsetp error - Subtracting one ss from another

1 REPLY 1
Reply
Message 1 of 2
Ethan_Gale
639 Views, 1 Reply

lselsetp error - Subtracting one ss from another

	(setq blockline (entlast));sets blockline to last polyline

	;zoom wall extents
	(command "ZOOM" "WINDOW" "_none" (list (- minx xtra) (- miny xtra)) "_none" (list (+ maxx xtra) (+ maxy xtra)))
	
	;select all polylines within profile view, filter for MESASTAN layer, set as allblocks selection set
	(setq blockxtra 2.0)
	(setq bl (list (- minx blockxtra) (- miny blockxtra)));bottom left point
	(setq tr (list (+ maxx blockxtra) (+ maxy blockxtra)));top right point
	(setq allblocks (ssget "W" bl tr '((8 . "MESASTAN"))));only select what is on mesastan layer from bottom left to top right
	
	;get all point values of blockline
	(setq blocklinelist nil);initializes blocklinelist
	(setq inc 0) ;set increment to 0
	(setq blockline (vlax-ename->vla-object blockline));convert to vlax object
	(while (<= inc (vlax-curve-getEndParam blockline)) ;progress through number of vertices
		(setq blxval (car (vlax-curve-getPointAtParam blockline inc))) ;get x coordinate of currrent polyline vertex
		(setq blyval (cadr (vlax-curve-getPointAtParam blockline inc))) ;get y coordinate of current polyline vertex	
		(setq blocklinelist (cons (list blxval blyval) blocklinelist)) ;creates list of point lists but needs reversing
		(setq inc (1+ inc));increase increment for next polyline point
	)
	(setq blocklinelist (reverse blocklinelist));reverses blocklinelist
	
	;only select what is on mesastan layer inside blockline by selecting via crossing polyline with blocklinelist points
	(setq profileblocks (ssget "_CP" blocklinelist '((8 . "MESASTAN"))))
	
	;Subtract profileblocks from selection set 1
	(setq inc (sslength profileblocks));set increment to size of profileblocks
	(repeat (inc)
		(setq ssentity (ssname profileblocks inc))
		(ssdel ssentity allblocks)
		(setq inc (- inc 1))
	)
	
	;delete selection set 1
	(command "ERASE" allblocks)

Hey Team,

 

The following code above gives me a lselsetp error, indicating that "A function requiring a selection set argument has been passed an argument of incorrect data type with the value noted in the error message". I've tried to document my code via comments, but let me know if any questions arise. 

 

Purpose of code:

  1. Select a series of polylines (small rectangles) via window selection (filter for layer MESASTAN).
  2. Set this selection set as allblocks
  3. Select a series of polylines (small rectangles) via crossing polyline selection of a preexisting polyline called blockline (filter for layer MESASTAN)
  4. Set this selection set as profileblocks
  5. Subtract selection set profileblocks from allblocks
  6. Delete allblocks (which is now allblocks - profileblocks)

There is a lot of previous code which I believed wasn't applicable to this error message; If you disagree, please advise and I can supply more! Any help would be appreciated!  Have a great Tuesday

1 REPLY 1
Message 2 of 2
cadffm
in reply to: Ethan_Gale

I didn't checked your goal and the whole code (because you also not posted the whole code),

but my comments:

 

 

 

Original code
;Subtract profileblocks from selection set 1 (setq inc (sslength profileblocks));set increment to size of profileblocks (repeat (inc) ; inc is a number, not a function (setq ssentity (ssname profileblocks inc)) ; read about ssname, it starts from 0, not from 1, inc is 1 to high.. (ssdel ssentity allblocks) ; WHY? (setq inc (- inc 1)) )
;changed

;Subtract profileblocks from selection set 1
(setq inc (sslength profileblocks));set increment to size of profileblocks
(repeat inc
  (setq ssentity (ssname profileblocks (setq inc (1- inc)))
)

 

 

 

 

Sebastian

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report