Create custom hatch - Arc/circle issue

Create custom hatch - Arc/circle issue

andstocco
Participant Participant
1,074 Views
12 Replies
Message 1 of 13

Create custom hatch - Arc/circle issue

andstocco
Participant
Participant

Hi all,

 

I am writing this post as I couldn't accomplish a particular design of a custom hatch in AutoCAD.

 

Being aware of the impossibility to script an arc or a circle in the acasiso.pat file, I created instead a polygon inscribed in a circle to mimic the desired arc path.
The final design resulted in 18 lines (see picture); however, I couldn't find a way to script them in the .pat file (I am aware of the SUPERHATCH command, but it is not what I am looking for this issue).


At the moment I am able to code only simple lines with standard angles, so I would be immensely glad if someone could help in sharing a method to achieve the desired result.

 

I read the very helpful threads from here: 

https://forums.autodesk.com/t5/autocad-forum/how-to-create-a-custom-hatch-with-an-arc-or-circle/td-p...

https://forums.autodesk.com/t5/autocad-forum/creating-custom-circular-hatch-pattern/m-p/9493360#M101...

but they do not really tackle the situation I am now in.

Thanks in advance for your help,
Andrea.

0 Likes
1,075 Views
12 Replies
Replies (12)
Message 2 of 13

Moshe-A
Mentor
Mentor

@andstocco hi,

 

it looks like a shingle hatch pattern, have you looked on web to find such, there are platy including free.

https://www.cadblocksdwg.com/roof-hatch-autocad.html

 

Moshe

 

0 Likes
Message 3 of 13

Kent1Cooper
Consultant
Consultant

I hope you can find an existing pattern that suits your needs, as suggested.  If you need to define your own, study how they are defined in the Customization Reference.  It will not be possible for the "arc" in segments to precisely follow the arc shape -- some of the segments will need to have their angles tweaked a little.  Every piece needs to be part of a line "family" lying along an infinite line, with pen-down parts and pen-up gaps.

 

In the attached, I exploded it and colored some pieces.  The blue segment must be in a family with something that falls along the same line [the magenta extension] farther along, and it looks like that won't take much of a tweak of the angle, because it's pretty close to hitting the same segment in another "arc," off to the right.  The green one's extension is cyan, and that misses by a greater amount; it could be made to incorporate that next green segment with a somewhat greater tweak of the angle, or it could reach farther beyond the included area to get closer to a "hit."  The red one's extension is yellow, and that's obviously not going to hit a close follower until farther out of the pattern area included.

 

Those are the kinds of complications involved.  This recent post has a pattern for "circles" of 24 segments, so you can see how many lines of code it takes to define such a thing.  I would recommend you consider whether fewer segments can be sufficiently curved-looking at the scales at which you would use the pattern, because it would greatly simplify the pattern definition.

Kent Cooper, AIA
0 Likes
Message 4 of 13

TomBeauford
Advisor
Advisor

Drawing attached with circular Hatch patterns in it. Wouldn't allow me to attach the pat files but you can extract them with GETPAT.LSP from https://www.thesourcecad.com/how-to-export-and-import-custom-hatch-pattern-in-autocad/

64bit AutoCAD Map & Civil 3D 2023
Architecture Engineering & Construction Collection
2023
Windows 10 Dell i7-12850HX 2.1 Ghz 12GB NVIDIA RTX A3000 12GB Graphics Adapter
0 Likes
Message 5 of 13

Kent1Cooper
Consultant
Consultant

@TomBeauford wrote:

.... Wouldn't allow me to attach the pat files ....


[You can .zip them and attach the .zip file.]

Kent Cooper, AIA
Message 6 of 13

TomBeauford
Advisor
Advisor

Thanks Kent Cooper, added Customization.zip below with circle patterns in it.
Bruno 'Bonuscad' Valsecchi's code posted by gile at: https://www.theswamp.org/index.php?topic=20355.msg247604#msg247604 both displays the pattern of a selected hatch then offers to save it to a pat file.

64bit AutoCAD Map & Civil 3D 2023
Architecture Engineering & Construction Collection
2023
Windows 10 Dell i7-12850HX 2.1 Ghz 12GB NVIDIA RTX A3000 12GB Graphics Adapter
0 Likes
Message 7 of 13

andstocco
Participant
Participant

Thank you @Moshe-A 
I found your resource helpful, and for sure I will have a use of it in the future.
However, I am now very interested in learning the actual process of scripting a personal design hatch.

0 Likes
Message 8 of 13

Sea-Haven
Mentor
Mentor

This may be helpful by Eldon Over at Cadtutor.

 

SeaHaven_0-1666299436339.png

 

0 Likes
Message 9 of 13

andstocco
Participant
Participant

Thanks @Kent1Cooper . This is actually what I have been investigating in my own trial-and-error test before posting it here. I am glad I had an intuition similar to your clear explanation.
I have been previously referring to the link you sent me (from autodesk) and check the tough code on the other thread beforehand, but it leave me with some questions.

1) are certain patterns (like mine in this instance) "wrong"? I mean, if the lines are not correctly aligned in certain angles, is it then not possible to code them?
2) if I will decrease the number of lines which miming the arc (let's say from 15 to 7) and geometrically calculated their correct intervals, how can I actually get the coordinates of the lines in an automated way (without dimensioning them "by hand")? I believe that the code of the 24-lines in the other post has been automatically processed.

 

Finally, is this (Hatch Maker | CAD Tips (cadalyst.com) a resource which can be used in my case? I retrieve it from the post you sent me, but I am not sure if it will possible to adapt it to my case. 


I am sorry if my doubts might be obvious or stated "incorrectly". I am almost new to this domain.

0 Likes
Message 10 of 13

andstocco
Participant
Participant
Very useful resource for many situation, thanks.
Still not sure, however, how and what I can (and cannot) code in my own situation.
0 Likes
Message 11 of 13

andstocco
Participant
Participant

Clear scheme, @Sea-Haven, will keep it in mind.
It summarize the overall concept, but it is hard to extend it to way broader system of lines with different angles.

0 Likes
Message 12 of 13

Sea-Haven
Mentor
Mentor

Trying to hand write is difficult maybe do a write to file, start with object at 0,0 then when click on object write out X,Y,ang,length do in correct sequence. May need more values per line as per image. This way have a start. I think angle is degrees.

 

Compare to a pattern already made using one of the Make Hatch lisp.

0 Likes
Message 13 of 13

hugha
Collaborator
Collaborator

You asked:


1) are certain patterns (like mine in this instance) "wrong"? I mean, if the lines are not correctly aligned in certain angles, is it then not possible to code them?

 

Nothing goes "wrong" until the numerical precision required to specify the pattern exceeds that handled by AutoCAD.

In practice satisfactory results result well within this limitation.  

 

2) if I will decrease the number of lines which miming the arc (let's say from 15 to 7) and geometrically calculated their correct intervals, how can I actually get the coordinates of the lines in an automated way (without dimensioning them "by hand")? I believe that the code of the 24-lines in the other post has been automatically

processed.

 

Study the code in Hatchmaker.lsp as a starting point.  

 

Finally, is this (Hatch Maker | CAD Tips (cadalyst.com) a resource which can be used in my case? I retrieve it from the post you sent me, but I am not sure if it will possible to adapt it to my case. 

 

HatchMaker confines pattern definition to be laid out within a unit square upon a 0.01 unit mesh.  To globally scale its output to suit larger squares you should multiply all numeric terms within the generated .PAT apart from the first (the angle) by a factor. 

 

Your original sketch suggests it may be possible to lay out and scale up from elements defined within these limitations.  

 

Note: if you wish finer precision than 0.01 you may find Autolisp unacceptably slow when handling extreme cases.

 

Hugh Adamson

www.hatchkit.com.au

 

 

 

 

 



0 Likes