Jump to content

Recommended Posts

Posted

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)
 )
)

Posted

After a cursory glance, a couple of things jump out:

(command "._hatch" [highlight]"_non"[/highlight] pt1 "")

(command "._hatchsetorigin" ss [highlight]"" "_non"[/highlight] pt1)

Posted
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).
Posted
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.

Posted
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!
Posted

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)
)

Posted
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)?
  • 3 months later...
Posted

(defun c:he ()(COMMAND "-HATCHEDIT" PAUSE "O" "S" PAUSE ""))

 

If you just want to grab one hatch and change it.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...