Saqib_theleo Posted September 29, 2022 Posted September 29, 2022 Hello everyone, I want a simple hatch Lisp which can select more than one objects and apply hatch. I tried this but it is only selecting one object and apply hatch to it. (Defun C:HH () (Command "-HATCH" "S" PAUSE "" "") ) Quote
tombu Posted September 29, 2022 Posted September 29, 2022 Isn't that what the Hatch command already does? 1 Quote
Saqib_theleo Posted September 29, 2022 Author Posted September 29, 2022 yes, but this is not selecting multiple objects. Quote
mhupp Posted September 29, 2022 Posted September 29, 2022 (edited) Try this. keeps pausing to allow you to select multiple. (Defun C:HH () (command "-HATCH" "S") (while (> (getvar 'cmdactive) 0) (command pause) ) ) or (Defun C:HH () (command "-HATCH" "S")) ;enter after selection Edited September 29, 2022 by mhupp Quote
Saqib_theleo Posted September 29, 2022 Author Posted September 29, 2022 Thanks for reply, this is giving this error. Command: HH -HATCH Current hatch pattern: ANSI31 Specify internal point or [Properties/Select objects/draW boundary/remove Boundaries/Advanced/DRaw order/Origin/ANnotative/hatch COlor/LAyer/Transparency]: S Select objects: ; error: bad function: "\\" Select objects: 1 found Select objects: 1 found, 2 total Select objects: Current hatch pattern: ANSI31 Specify internal point or [Properties/Select objects/draW boundary/remove Boundaries/Advanced/DRaw order/Origin/ANnotative/hatch COlor/LAyer/Transparency]: and after selecting objects have to hit enter 2 times. Quote
tombu Posted September 29, 2022 Posted September 29, 2022 14 minutes ago, Saqib_theleo said: yes, but this is not selecting multiple objects. Odd, tried using crossing window to select groups of rectangles and shift+crossing windows to unselect and it worked fine for me. Fence worked too, how were you trying to select? Quote
Saqib_theleo Posted September 29, 2022 Author Posted September 29, 2022 2 minutes ago, tombu said: Odd, tried using crossing window to select groups of rectangles and shift+crossing windows to unselect and it worked fine for me. Fence worked too, how were you trying to select? I select closed pline and text one by one. Quote
tombu Posted September 29, 2022 Posted September 29, 2022 6 minutes ago, Saqib_theleo said: I select closed pline and text one by one. In your lisp you used "S" to use Select objects mode. You would need to pick "Select objects", enter "S" or set HPPICKMODE (System Variable) to 1 which would make "Select objects" the default to pick objects the way you want. Then you could multiple select plines and text all at once. Quote
Saqib_theleo Posted September 29, 2022 Author Posted September 29, 2022 I cannot change HPPICKMODE to 1 it says Command: HPPICKMODE HPPICKMODE = 0 (read only) Quote
Saqib_theleo Posted September 29, 2022 Author Posted September 29, 2022 1 hour ago, tombu said: In your lisp you used "S" to use Select objects mode. You would need to pick "Select objects", enter "S" or set HPPICKMODE (System Variable) to 1 which would make "Select objects" the default to pick objects the way you want. Then you could multiple select plines and text all at once. even changing it to 1 does not select multiple objects. as i select 1st object it draws hatch instantly. Quote
tombu Posted September 29, 2022 Posted September 29, 2022 1 minute ago, Saqib_theleo said: even changing it to 1 does not select multiple objects. as i select 1st object it draws hatch instantly. It's supposed to do that with each object you select. Drag your cursor to select multiple objects or enter "F" to select using the Fence option or whatever option you were going to use in the lisp. Quote
Saqib_theleo Posted September 30, 2022 Author Posted September 30, 2022 8 hours ago, mhupp said: Try (setvar 'pickadd 1) did that but still selecting one object. Quote
tombu Posted September 30, 2022 Posted September 30, 2022 16 hours ago, Saqib_theleo said: even changing it to 1 does not select multiple objects. as i select 1st object it draws hatch instantly. Select everything first then use the Hatch command and when you get to the "Select objects" prompt enter "P" to select your previous selection. Quote
Saqib_theleo Posted September 30, 2022 Author Posted September 30, 2022 4 hours ago, tombu said: Select everything first then use the Hatch command and when you get to the "Select objects" prompt enter "P" to select your previous selection. actually I want a simple Lisp which can be done in minimal click and keys, I want that when I run hatch Lisp it prompts me to select objects in my case it is closed boundary and text (because I want trim hatch on text) and after selecting these 2 objects it creates instantly last used hatch. If someone can make this Lisp that will be nice. Thank you. Quote
Steven P Posted September 30, 2022 Posted September 30, 2022 (edited) Am I missing something here, what is wrong with using a selection set, something like: (defun c:hh ( / ) (setq MySS (ssget '((-4 . "<OR") (0 . "LWPOLYLINE") (0 . "*TEXT") (-4 . "OR>"))) ) (Command "-HATCH" "S" MySS "" "") ) You could add to this looping through the selection set to remove any polyline that is not a closed polyline (internet search gave me this snippet which could be used for that https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/check-to-see-if-polyline-is-closed/td-p/859164 ) (and just to note a 'simple Lisp' is often the most complex, which makes it simple for the user, can add in checks that a polyline is closed.... the LISP gets better but not so simple) Edited September 30, 2022 by Steven P 3 Quote
Saqib_theleo Posted September 30, 2022 Author Posted September 30, 2022 38 minutes ago, Steven P said: Am I missing something here, what is wrong with using a selection set, something like: (defun c:hh ( / ) (setq MySS (ssget '((-4 . "<OR") (0 . "LWPOLYLINE") (0 . "*TEXT") (-4 . "OR>"))) ) (Command "-HATCH" "S" MySS "" "") ) You could add to this looping through the selection set to remove any polyline that is not a closed polyline (internet search gave me this snippet which could be used for that https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/check-to-see-if-polyline-is-closed/td-p/859164 ) (and just to note a 'simple Lisp' is often the most complex, which makes it simple for the user, can add in checks that a polyline is closed.... the LISP gets better but not so simple) Hi @Steven P, Yes this is exactly what I need, works great. It is Selection set which was missing but you made it in to code, so nice. Right now checking closed polyline is not issue but may be later it will be required. and yes you are right a "Simple Lisp" can be more complex in these cases I can understand. Thank you for your help. 1 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.