Holybod Posted March 17, 2015 Posted March 17, 2015 Hi Guys, I'm currently working on a large scale map. The map I've purchased contains building areas as hatching but no boundary outline (to my shock). The map is laid out in tiles which has meant on many occasions buildings have been cut into 2 or more sections rather than the 1. I have downloaded a Merge Hatch.Lsp which merges all the building Hatches together but when I go to recreate boundary via 'HATCHEDIT' it just draws a line around each piece of hatching rather than the whole lot. Can anyone help me with this please, Many Thanks. Liam Quote
ReMark Posted March 17, 2015 Posted March 17, 2015 (edited) I think I might be able to help but you will have to change the lisp routine you are currently using to merge your hatch patterns and adopt a second lisp routine that will create a single boundary. CAVEAT: I've only tested this technique once using nearly square hatch patterns. Here is an image of what I did. Upper left corner. Two boxes created with the Rectangle command which I hatched then moved the two hatch patterns to the right assigning each a different color (yellow and blue). Used a lisp routine by forum member hmsilva that he graciously wrote and shared on the AutoDesk Community website and posted to the Visual Lisp...forum on 04-12-2013 to merge the two patterns. Result is shown below in green. Finally, used a lisp routine called Hatchb.lsp written (03-30-2000) by Jimmy Bergmark that recreates a hatch boundary. If you look at the bottom rectangle on the right you'll see a single magenta boundary that surrounds the two merged hatch patterns. I suppose there is a chance that this lisp routine will solve your problem all by itself. Might want to give it a try first. My test was a simple one. As the saying goes "Your results may vary." I'm only around for another five minutes then I have to go out into the plant. May not be back for a while. Edited March 17, 2015 by ReMark can't spell today & I don't know my left from my right! Quote
BIGAL Posted March 17, 2015 Posted March 17, 2015 (edited) There was a post about 2 weeks ago and it did exactly what you want taking multiple plines and working out the single boundary of all of them you can create the hatch boundaries pretty easy. I know I replied to the post but another provided the solution will look for it soon. Edited March 18, 2015 by BIGAL Quote
BIGAL Posted March 18, 2015 Posted March 18, 2015 The title did not really make it easy to find http://www.cadtutor.net/forum/showthread.php?91174-please-help-Lisp-localize-objects-with-the-same-content! Quote
Holybod Posted March 18, 2015 Author Posted March 18, 2015 (edited) Thanks Guys, I will test these out and let you know how I get on... ... Struggling to find hmsilva's lisp on the AutoCAD Community website. Do you have a link? When using the HATCHB.lsp along with the MergeHatch.lsp I already have I am encountering the same issues I had before. Edited March 18, 2015 by Holybod Quote
lrm Posted March 18, 2015 Posted March 18, 2015 Here's another approach that relies only on standard AutoCAD commands. You can use this process on all hatches at the same time. Use HATCHGENERATEBOUNDARY to generate the boundary for all hatches then convert the boundaries to Regions then use Union to create contiguous regions from which you can use the Hatch S command to hatch the result. Quote
ReMark Posted March 18, 2015 Posted March 18, 2015 "When using the HATCHB.lsp along with the MergeHatch.lsp I already have I am encountering the same issues I had before." I kind of figured you would. Wait here, I'll be back. I've attached the lisp routine below. Note that he gave it the command name "test" which you will have to change. I named the lisp routine HatchMerge.lsp to differentiate it from the MergeHatch.lsp routine which I too have. HatchMerge.lsp I added two lines to the lisp routine right at the top crediting hmsilva as the author. Please do not remove them. Quote
ReMark Posted March 18, 2015 Posted March 18, 2015 Here's another approach that relies only on standard AutoCAD commands. You can use this process on all hatches at the same time.Use HATCHGENERATEBOUNDARY to generate the boundary for all hatches then convert the boundaries to Regions then use Union to create contiguous regions from which you can use the Hatch S command to hatch the result. A person could die of old age using that method on a very busy drawing. Just saying. Quote
hmsilva Posted March 18, 2015 Posted March 18, 2015 I added two lines to the lisp routine right at the top crediting hmsilva as the author. Please do not remove them. Thank you! ReMark Henrique Quote
Holybod Posted March 18, 2015 Author Posted March 18, 2015 Hi ReMark, Thanks again for putting your time into this. I've tested the HATCHMERGE.lsp which works brilliantly on basic rectangles like your example. However, when using this routine on more complex shapes with numerous vertex points it purely deletes/removes them rather then merging. Quote
hmsilva Posted March 18, 2015 Posted March 18, 2015 ...when using this routine on more complex shapes with numerous vertex points it purely deletes/removes them rather then merging. Hi Holybod, could you attach a sample dwg with some hatches that gives you error. Henrique Quote
lrm Posted March 18, 2015 Posted March 18, 2015 A person could die of old age using that method on a very busy drawing. Just saying. Not really. You can select all the hatched areas at the same time which would take less than a minute if layers were intelligently used. The other commands I listed can also be used with all the hatched areas at the same time as well. Total time could be less than a few minutes. Try it. Quote
ReMark Posted March 18, 2015 Posted March 18, 2015 I'd sooner gouge my one good eye out with a spoon. A spoon? Why? Because it would hurt more! Quote
lrm Posted March 18, 2015 Posted March 18, 2015 I'd sooner gouge my one good eye out with a spoon. A spoon? Why? Because it would hurt more! Funny. I guess you like debugging lisp code. Have fun with that. I thought I'd offer the OP a working, efficient solution that doesn't require debugging. Quote
ReMark Posted March 18, 2015 Posted March 18, 2015 No I don't like debugging lisp code. I leave tasks like that to people who know what they are doing. I guess we would know better how well the method works if the OP were to provide an actual drawing that he is working on. Then the two of you can apply the method you have described and compare notes afterwards. Quote
Holybod Posted March 19, 2015 Author Posted March 19, 2015 Map Hatching Example.dwg Apologises for the wait, please find attached DWG. Quote
ReMark Posted March 19, 2015 Posted March 19, 2015 Did you try Irm's suggested method? How representative is your example drawing? It has about 5000 hatch objects. Is this about average or could a drawing have two, even three (or more) times that many hatch objects? Quote
hmsilva Posted March 19, 2015 Posted March 19, 2015 (edited) Hi Holybod, I did reproduce that error. The error is because the code uses the command '-hatchedit' and AutoCAD can't resolve the boundaries in almost all existing hatches in your dwg...Why? I do not know... I did also noticed, using the HATCHGENERATEBOUNDARY command, AutoCAD can resolve the boundaries... I am out of the office, but later, I see what I can do to rewrite the code using the HATCHGENERATEBOUNDARY command... EDIT: Sorry Holybod, but, after some thought I believe it will not be viable using the HATCHGENERATEBOUNDARY command in the code, because it will be practically impossible to ensure the relationship between the outer boundary and existing Islands... Your dwg hatches were generated using some weird UCS, as a result AutoCAD can't resolve the boundaries with '-hatchedit' command. Open your dwg, ucs World, command flatten, select all hatches, try now the MergeHatch.lsp Henrique Edited March 19, 2015 by hmsilva Quote
Holybod Posted March 19, 2015 Author Posted March 19, 2015 The 'Map Hatching Example.dwg' is the building Areas of the map in question, copied to another file. I was given the map to work from by another company who had produced the map themselves. I will give that a go, I don't have AutoCAD at my office but will let you know how I get on with both or your methods. Again thanks for your time taken on this. Quote
lrm Posted March 19, 2015 Posted March 19, 2015 I tried my method on the OP's posted drawing. The good news... HATCHGENERATEBOUNDARY followed by REGION then UNION then EXPLODE will create 2076 individual appropriately merged boundaries from the 4790 hatched areas. The bad news... hatching the 2076 regions in one step yields one hatched area which I cannot separate into individual hatched areas (if that is what the OP wants). Perhaps this is the point where VLISP is needed. Note, the default file yields a very dense pattern. I changed it to solid fill. https://dl.dropboxusercontent.com/u/18135203/Merged-Boundaries-ManyRegions.dwg 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.