broncos15 Posted December 31, 2015 Posted December 31, 2015 So I am in the very beginning stages of creating a lisp that creates a hatch and sets the origin all in one command. I am wanting to do this because every time I create a concrete hatch, I end up having to reset the origin because it doesn't come out right. This is the very beginning stages of the code, so I haven't added in my settings portion to make it appear just like the hatch command or any error trapping yet. The code keeps giving errors and not working correctly , and I think it has to do with my ssget function, but I am unsure. Does anyone have any suggestions? (defun c:hatch2 () (while (setq pt1 (getpoint "\nPick Internal point: ")) (command "._hatch" pt1 "") (setq ss (ssget "_L")) (command "._hatchsetorigin" ss pt1) ) ) Quote
Lee Mac Posted December 31, 2015 Posted December 31, 2015 After a cursory glance, a couple of things jump out: (command "._hatch" [highlight]"_non"[/highlight] pt1 "") (command "._hatchsetorigin" ss [highlight]"" "_non"[/highlight] pt1) Quote
broncos15 Posted December 31, 2015 Author Posted December 31, 2015 After a cursory glance, a couple of things jump out: (command "._hatch" [highlight]"_non"[/highlight] pt1 "") (command "._hatchsetorigin" ss [highlight]"" "_non"[/highlight] pt1) Thanks Lee, that got me on the right track! I am wanting to get better at debugging, so just curious, what does _non do, and how did you know that you had to put it in (I was just following the command prompts while writing it, and didn't see a place that I would have had to put something else in). Quote
Lee Mac Posted December 31, 2015 Posted December 31, 2015 Thanks Lee, that got me on the right track! You're welcome! what does _non do, and how did you know that you had to put it in See the first half of this tutorial for an explanation - point data supplied to commands through AutoLISP is affected by active Object Snaps. Quote
broncos15 Posted December 31, 2015 Author Posted December 31, 2015 See the first half of this tutorial for an explanation - point data supplied to commands through AutoLISP is affected by active Object Snaps. As usual, your tutorial was super helpful, thank you! Quote
BIGAL Posted December 31, 2015 Posted December 31, 2015 broncos15 your right concrete and gravel are two hatches we always need to reset the origin pt on as we work in real world co-ords. The other thing is generally only need to set origin once if working in model space. A slight variation if you have already drawn the hatch. ; set hatch origin ; by Alan H Jan 1 2016 (defun c:HO ( / obj pt) (setq obj (entsel "pick hatch)) (setq pt (cadr obj)) (command "._hatchsetorigin" obj "" "_non" pt) ) Quote
broncos15 Posted January 7, 2016 Author Posted January 7, 2016 broncos15 your right concrete and gravel are two hatches we always need to reset the origin pt on as we work in real world co-ords. The other thing is generally only need to set origin once if working in model space. A slight variation if you have already drawn the hatch. ; set hatch origin ; by Alan H Jan 1 2016 (defun c:HO ( / obj pt) (setq obj (entsel "pick hatch)) (setq pt (cadr obj)) (command "._hatchsetorigin" obj "" "_non" pt) ) Thanks Big Al! That is very useful and save a few clicks (especially when I am in other people's drawings where they forget to set the origin). I am curious, is there any disadvantage to setting the hporiginmode variable to something other than 0, so that the hatches are automatically created correctly (I was thinking of setting it to 5)? Quote
betazero Posted May 4, 2016 Posted May 4, 2016 (defun c:he ()(COMMAND "-HATCHEDIT" PAUSE "O" "S" PAUSE "")) If you just want to grab one hatch and change it. 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.