jonathann3891 Posted August 29, 2019 Posted August 29, 2019 (edited) I'm having an issue with a selection set. This is a work in progress but what it does is creates 3d grating out the grate hatch pattern. The problem I'm having is after the lines are turned into polylines, I'm losing the selection set "SS2". (defun c:ttt (/ OS PTZ SS SS2) (setq OS (getvar 'osmode)) (setvar 'osmode 7) (command "id" pause) (setq PTZ (rtos (setq PTZ# (caddr (getvar 'lastpoint))) 4 4)) (command "-hatch" "_P" "Grate" "32" "" "S" pause "" "") (setq SS (entlast)) (command "_.CHANGE" SS "" "_P" "_E" PTZ "") (command "explode" SS) (setq SS2 (ssget "_P")) (command "_pedit" "m" SS2 "" "y" "w" "3/16" "") (command "_.CHANGE" SS2 "" "_P" "_T" "1" "") ;;;SS2 stops working ) On a side note, how come this works: (command "id" pause) (setq PTZ (rtos (setq PTZ# (caddr (getvar 'lastpoint))) 4 4)) But this doesn't work: ( getpoint "\nTEST POINT : ") (setq PTZ (rtos (setq PTZ# (caddr (getvar 'lastpoint))) 4 4)) Edited August 29, 2019 by jonathann3891 Quote
Lee Mac Posted August 29, 2019 Posted August 29, 2019 3 hours ago, jonathann3891 said: On a side note, how come this works: (command "id" pause) (setq PTZ (rtos (setq PTZ# (caddr (getvar 'lastpoint))) 4 4)) But this doesn't work: ( getpoint "\nTEST POINT : ") (setq PTZ (rtos (setq PTZ# (caddr (getvar 'lastpoint))) 4 4)) The LASTPOINT system variable stores the last point supplied to a command, not the last point obtained using an AutoLISP expression. However, neither of the two methods you have posted are necessary, as you can use getpoint directly, e.g.: (if (setq pt (getpoint "\nTest point: ")) (setq ptz# (caddr pt) ptz (rtos ptz# 4 4) ) ) Quote
Lee Mac Posted August 29, 2019 Posted August 29, 2019 3 hours ago, jonathann3891 said: The problem I'm having is after the lines are turned into polylines, I'm losing the selection set "SS2". (defun c:ttt (/ OS PTZ SS SS2) (setq OS (getvar 'osmode)) (setvar 'osmode 7) (command "id" pause) (setq PTZ (rtos (setq PTZ# (caddr (getvar 'lastpoint))) 4 4)) (command "-hatch" "_P" "Grate" "32" "" "S" pause "" "") (setq SS (entlast)) (command "_.CHANGE" SS "" "_P" "_E" PTZ "") (command "explode" SS) (setq SS2 (ssget "_P")) (command "_pedit" "m" SS2 "" "y" "w" "3/16" "") (command "_.CHANGE" SS2 "" "_P" "_T" "1" "") ;;;SS2 stops working ) You will need to obtain the last entity in the database (using entlast) prior to issuing the PEDIT command, and then step through and collect the entities added by the PEDIT command (using entnext). Quote
Roy_043 Posted August 29, 2019 Posted August 29, 2019 Alternative: Put the hatch on a temporary dedicated layer. You can then create create SS, SS2 and SS3 by filtering for that layer. Quote
Lee Mac Posted August 29, 2019 Posted August 29, 2019 1 hour ago, Roy_043 said: Alternative: Put the hatch on a temporary dedicated layer. You can then create create SS, SS2 and SS3 by filtering for that layer. Great idea Roy, I've never previously considered that route. Quote
BIGAL Posted August 30, 2019 Posted August 30, 2019 (edited) My $0.05 would it not be easier to just make the grate as line work you can group objects so it appears as 1 object, if you want as a full solid again not a problem. You can have different types or spacings. Here in AUS we use a weave grate a lot as its bicycle safe. A quick 3d is to use lines and thickness its about how accurate you want. Edited August 30, 2019 by BIGAL Quote
Roy_043 Posted August 30, 2019 Posted August 30, 2019 15 hours ago, Lee Mac said: Great idea Roy, I've never previously considered that route. Main reason for this approach: entlast is not very reliable. Quote
jonathann3891 Posted August 30, 2019 Author Posted August 30, 2019 20 hours ago, Lee Mac said: The LASTPOINT system variable stores the last point supplied to a command, not the last point obtained using an AutoLISP expression. However, neither of the two methods you have posted are necessary, as you can use getpoint directly, e.g.: (if (setq pt (getpoint "\nTest point: ")) (setq ptz# (caddr pt) ptz (rtos ptz# 4 4) ) ) That's way better than the way I was doing it, Thanks Lee! Quote
jonathann3891 Posted August 30, 2019 Author Posted August 30, 2019 I found something from Kent Cooper that's working. ;; LastNo.LSP [function name: LN] ;; To select the Last user-specified Number of Entities ;; Use by typing (LN qu) where 'qu' is integer quantity of entities desired ;; Kent Cooper; last edited July 2009 ;; (defun LN (qu / sset ssn) (setq sset (ssadd)) (repeat qu (if (entlast) (progn (ssadd (entlast) sset) (entdel (entlast)) ); end progn ); end if ); end repeat (if sset (progn (setq ssn (sslength sset)) (while (>= (setq ssn (1- ssn)) 0) (entdel (ssname sset ssn)) (redraw (entlast) 3) ); end while ); end progn ); end if sset ); end defun Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.