Custom hatch pattern does not work

Custom hatch pattern does not work

karenMV87H
Contributor Contributor
1,927 Views
13 Replies
Message 1 of 14

Custom hatch pattern does not work

karenMV87H
Contributor
Contributor

Hi,

I have created a custom pattern and it works perfectly fine in Autocad 2022- 2023 versions. I have a colleague using Autocad 2007 and she's not able to use them because it shows this error. I'm wondering if it's because the pattern is complex that is not working.

 

I can see the field is selected by responding with a dashed outline but then simply does not load the pattern when I hit OK.
 
This is the error message I'm getting in the command box:
 
everything...
Selecting everything visible...
Analyzing the selected data...
Analyzing internal islands...
Pick internal point or [Select objects/remove Boundaries]:
Bad pattern definition file:
Missing parameter on line 5.
?
*see screenshot attached. txt file also attached. 
 
Any thoughts or solutions would be appreciated.
Thank you 
 

 

0 Likes
Accepted solutions (1)
1,928 Views
13 Replies
Replies (13)
Message 2 of 14

Kent1Cooper
Consultant
Consultant

Help for 2023 still says this:

 

Kent1Cooper_0-1655484983483.png

 

Most lines in that pattern definition exceed that, unless perhaps spaces within a line don't count against the 80 characters.  Maybe by more recent versions that limitation has been increased [but not updated in Help], but was still in effect in 2007.  Though why it says the problem is on line 5, I couldn't say, nor whether "line 5" means the 5th line in the file, or the 5th "operational" line [omitting the commented-out ones], or the 5th line of the actual definition [also omitting the pattern-name header line].

 

But in case that's the issue, try taking out the spaces first, and if the problem persists, try reducing the number of decimal places in some of the numbers.  If you can get it down to where all lines are unambiguously less than 80 characters long, and it still doesn't work, I don't know what else to suggest, but write back anyway.

Kent Cooper, AIA
Message 3 of 14

hugha
Collaborator
Collaborator

Try this, with six pattern lines all less than 80 characters long

 

;-------------------------------------------------------------------------------
; Written by HatchKit 4 Standard Edition
; HatchKit 4 Standard Edition (c)1990-2022 Cadro Pty Ltd
; www.hatchkit.com.au/
;-------------------------------------------------------------------------------
;-Date : 2022-06-18
;-Time : 07:26:47
;-HatchKit 4 Version : 4.2.1.3181
;-HatchKit 4 Output Filetype : AutoCAD®
;-------------------------------------------------------------------------------
*M_hivepicket,HatchKit Design
30.141386,0,0,-29.8857333,.06873429,.66944,-32.81875
30.963757,-.56025,1.7928,-127.164657,.0176021,.65336,-130.11437

90,.57892,.33615,1.867499,.616275,1.4567,-2.278349
90,-.56025,.33615,1.867499,.616275,1.4567,-2.278349
149.036243,0,0,127.16465729,.01760210,.65336,-130.1143
149.858614,.57892,1.7928,29.88573,.06873429,.66944,-32.81875

 

 

Whatever generated the pattern you posted is unsuitable to prepare hatch patterns for direct use with AutoCAD 2007 where the line length limit is 80 characters.  It comes as undocumented and welcome news that that limit appears to have been relaxed in your much later version.

 

hth,

Hugh Adamson

www.hatchKit.com.au

 

0 Likes
Message 4 of 14

karenMV87H
Contributor
Contributor

thanks so much!! I've tried this one but it didn't work in AutoCAD LT 2023 

I'm unable to apply the pattern

 

0 Likes
Message 5 of 14

karenMV87H
Contributor
Contributor

you are probably right, but I have no idea have to reduce the numbers. It's just so complicated!

0 Likes
Message 6 of 14

Kent1Cooper
Consultant
Consultant

@karenMV87H wrote:

.... I'm unable to apply the pattern

 


Be aware that:
1)  If it's in a .pat file of its own, the file name and the pattern name defined in it must match exactly; and

2)  The file needs to end with a blank line, not with the last line of pattern definition code.

 

If you ensure those things, does it work?

Kent Cooper, AIA
0 Likes
Message 7 of 14

Kent1Cooper
Consultant
Consultant

@karenMV87H wrote:

you are probably right, but I have no idea have to reduce the numbers. It's just so complicated!


You can start by taking all numbers with 9 decimal places and lopping off the last 2 from all of them.  [It may not make a noticeable difference, but if you want, you could round them "properly," e.g. turn something like -21.125247175 into -21.1252472 rather than just chopping off the 75.]  Along with eliminating spaces within code lines, I expect that will make all lines short enough, if the problem is in fact the number of characters in a line.

Kent Cooper, AIA
0 Likes
Message 8 of 14

karenMV87H
Contributor
Contributor

that's exactly what I'm doing. I'm probably doing something wrong, but the pattern looks incomplete, with some open lines 

 

 

0 Likes
Message 9 of 14

pendean
Community Legend
Community Legend

@karenMV87H wrote:

thanks so much!! I've tried this one but it didn't work in AutoCAD LT 2023 

I'm unable to apply the pattern

 


I believe the rewritten hatch pattern is for the 2007 user, not your LT2023 seat. Have they tried it, and how do the two hatch patterns compare when you get their file back from them?

 

 

Your challenge is no one here has access to 2007, and AutoCAD's hatching abilities have changed in between: start developing a workaround.

 

Good luck.

0 Likes
Message 10 of 14

Kent1Cooper
Consultant
Consultant

If I set the origin to the middle of the Hatch, it looks about right near that origin, but it pretty quickly diverges.  So something is off, probably about the pen-down/pen-up numbers.  But I do find it peculiar that, in both your original and @hugha 's HatchKit simplification, the line sets that look parallel in the result are not really at the same angles [except the vertical ones].  How critical is the exact sizing of things?

 

Have you tried eliminating the spaces and reducing the number of decimal places in the original one?  For me, that doesn't have the same displacement issue as you get farther from the origin that the shortened definition suffers from, so if it's only a number-of-characters issue, reducing in that way should fix it.

Kent Cooper, AIA
0 Likes
Message 11 of 14

Kent1Cooper
Consultant
Consultant

@Kent1Cooper wrote:

....

Have you tried eliminating the spaces and reducing the number of decimal places in the original one?  .....


Yes, it should be definable in just 6 lines, but I found that [without having to think about it deeply], just quickly removing all the spaces gets all lines below 80 characters.  Does the attached work?

Kent Cooper, AIA
0 Likes
Message 12 of 14

richard_387
Advocate
Advocate

I merely removed the spaces from your first file posted and the hatch worked. The posted file seems to be formatted with extra spaces to help understand the hatch construction but spaces are precious in the definition file line limit of 80 spaces.

 

I am intrigued with the hatch not being symmetrical. I suppose you worked hard for that and over-riding 60 degree angles with aesthetics. 

0 Likes
Message 13 of 14

karenMV87H
Contributor
Contributor

that's correct, I wanted to be as precise as possible with a scaled tile I used from a photo. 

I guess next time I will just use a photo as reference only and not for tracing it. 

0 Likes
Message 14 of 14

karenMV87H
Contributor
Contributor
Accepted solution

So I think I have come to the bottom of the issue. 

This pattern was created tracing an image, and it is very dense in code. I have similar patterns that I have created and have worked perfectly fine in 2021+ versions

 

So I have come to this page on Autodesk official website and this might be the solution:

Display of Dense Hatch Patterns (Here is the source link)

If you create a very dense hatch pattern, the program may reject the hatch and display a message indicating that the hatch scale is too small or its dash length too short. Change the maximum number of hatch lines by setting the HPMAXLINES system variable to a whole number between 0 and 10000000 (ten million), in AutoCAD 2008-based products and later.

In AutoCAD 2007-based products and earlier, the MaxHatch environment variable was required to change the maximum number of hatch lines that the program would draw:
  • In AutoCAD LT, use SETENV and enter a valid number.
  • In non-LT products, use the AutoLISP expression (setenv "MaxHatch" "n") where n is a valid number.
Note: In either case, when changing the value of MaxHatch, you must enter MaxHatch with the capitalization as shown.
 
I will have my partner to follow these steps, but I'm so glad this issue have been resolved in earlier versions. 
 
Also thanks so much everyone for your help! I'm really learning everyday from all of you! 

 

0 Likes