Jump to content

Recommended Posts

Posted

Is it possible to extend/offset the hatch boundary by 8 cm on all sides using lisp?

 

I use recreate hatch boundary and then use bpoly to get the boundary in polyline and then offset the pline by 8 and hatch it again. It's a time consuming task and hope someone can help me with it. Thank you.

Posted

Here is a simple code, but before using it please take note that:

1- It has no error trapping, so be aware not to make mistakes.

2- The program doesn't erase the existing boundary of the selected hatch.

3- May be the boundary of selected hatch is more than one.

4- May be the offseting the boundary cause to create more than one boundary.

(defun C:OH () (C:OffsetHatch))
(defun C:OffsetHatch (/ *h* *pt* *b1* *b2*)
   (setq *h* (entsel "\nSelect Hatch to offset: ")); [be sure to select hatch object, not other kind of entity]
   (setq *pt* (getpoint "Specify point on side to offset: "))
   (command "_.-HATCHEDIT" *h* "_B"; Rrecreate Boundary
            "_P"; Polyline, [sometimes autocad creates region]
            "_Y"; Yes
   )
   (setq *b1* (entlast)); boundary, [may be more than one boundary created]
   (command "_.OFFSET" 8 *b1* *pt* "")
   (setq *b2* (entlast))
   (command "_.-HATCHEDIT" *h* "_AD" "_S" *b2* "" "")
   (entdel *b1*)
)

Posted

Thanks Ahankhah, that worked but for only one boudary (pickpoint). It doesn't work if it the hatch have more than one boundary. I'm gonna leave that aside for now.

 

I was thinking of exploding the boundary/region and pedit the exploded region line and pedit to make it a pline and offset it by 8. My question is, how can I use "ssget" to pick the exploded boundary/region lines so I can pedit and join the selection set.

 

Or probably a code that would change a region to a polyline lisp would be nice. I've search and but couldn't find a working one. Thanks.

Posted

If I understand correctly your mean when writing "that worked for only one boundary", probably if you separate unique hatches with more than one boundary, the problem will be solved partly.

So add this to your code:

 

(defun C:SepH()(command"_.-HATCH" (entsel) "_H" ""))

 

... and before running "Oh", issue "Seph" command.

Posted

outstanding, but is there a method in which the user can input an arbitrary distance?, in the example the hatch offsets 8 meters, but what if we need one offset of 0.10 meters and another with 1.5 meters?, thanks in advance

Posted
(defun C:OH () (C:OffsetHatch))
(defun C:OffsetHatch (/ *h* *pt* [color=red]*dist*[/color] *b1* *b2*)
   (setq *h* (entsel "\nSelect Hatch to offset: ")); [be sure to select hatch object, not other kind of entity]
   (setq *pt* (getpoint "Specify point on side to offset: "))
   [color=red](setq *dist* (getdist "\nSpecify offset distance: "))[/color]
   (command "_.-HATCHEDIT" *h* "_B"; Rrecreate Boundary
            "_P"; Polyline, [sometimes autocad creates region]
            "_Y"; Yes
   )
   (setq *b1* (entlast)); boundary, [may be more than one boundary created]
   (command "_.OFFSET" [color=red]*[/color][color=red]dist*[/color] *b1* *pt* "")
   (setq *b2* (entlast))
   (command "_.-HATCHEDIT" *h* "_AD" "_S" *b2* "" "")
   (entdel *b1*)
)

Posted

many thanks, works to perfection, congratulations, tremendous effort

Posted
many thanks, works to perfection, congratulations, tremendous effort

You are welcome:).

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