Community
AutoCAD LT Forum
Welcome to Autodesk’s AutoCAD LT Forums. Share your knowledge, ask questions, and explore popular AutoCAD LT topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Automatic Area field tag when hatching profiles

11 REPLIES 11
SOLVED
Reply
Message 1 of 12
nikm42Q9N
4960 Views, 11 Replies

Automatic Area field tag when hatching profiles

Good day mighty auto-cad wizards, im in need of your assistance. I make shop tickets for a stone company, part of this process is figuring cubic feet of materiel for each peace.What i typically do is 

 

1. make my three view drawing of the stone

2. Hatch the Profile view 

3.Add area field to hatch to get the square inches of the profile

4. Plug profile area and length into excel sheet to get cubic feet.

 

Step 4 is done at one time for all stones in a excel sheet so what i do is steps 1 through 3 for all stones and i like having the area tag right there on my ticket so i don't have to click on the hatch and open properties to get the area info

 

Now this doesn't seem like much but each job could have 10 to 100 different stone shapes. My question is this i run Autocad LT as it is all im able to get from my work so LISP is out of the question. But could a routine or macro me made to package together the hatch and field commands??

 

What i would like to be able to do is hatch a profile and have the filed data automatically be inserted 

 

The commands are pretty much the same every time......(Hatch, pick points, enter, field, enter, object , area, pick object, enter.) not allot but when you got more than a few profiles this command string gets old fast.

 

Any suggestions would be greatly appreciated 

11 REPLIES 11
Message 2 of 12
pendean
in reply to: nikm42Q9N

>>>...to do is hatch a profile and have the filed data automatically be inserted ...<<<
Not really since there is no core commandline version of FIELD command. BUT... if you want to predefine a hatch with a field tied to it already, save it as a block, place it in a ToolPalette, then drag/drop, explode, and stretch out using grip editing to fit your area that would be an option. Depends on how complex your shapes are would determine if this is viable or not.
Message 3 of 12
steven-g
in reply to: nikm42Q9N

Hopefully this will work at your end, attached is a dwg file that will be used as a block to insert in your working drawing, you need to have it in a folder that is in your support path (or inserted into your drawing). You can find which folders are in the support path by opening Autocad options and looking in the files tab (or try a web search for more info). With the file in your support path run the following macro (you did mention macro's so I'm relying on you to know where you will place it. The hatch type "ansi37" can be changed to suit what you normally use.

*^C^C^C-hatch;p;ansi37;;;\;-la;m;area;;hatchgenerateboundary;l;;region;l;;-insert;*area;$M=$(getvar,lastpoint);1;0;union;$(getvar,lastpoint);a;all;;-la;t;done;m;done;;-laymrg;n;area;;n;done;y;-la;m;0;f;done;;rea;

The first character in the macro is a "*" that makes the macro repeat until you hit the escape key. To use it, the macro will start the hatch command and wait for you to pick a point within your required boundaries. That's it keep picking points.

 

Now for the possible problems.

The block is drawn in metric units so it might need adjusting to suit, it only contains a region of 1x1 unit and a field that reads that regions area. The region is on a layer called "area" and this same name is used in the macro, along with a layer named "done" to keep things organised, and to allow the macro to work correctly.

Because coordinate entry in a macro is affected by osnaps and zoom level, I moved the field 100 units away from the region, just a technical point but it is possible that something could fail, you can move the field later if you want, to line up with your hatches. And text size might need adjusting.

This also creates extra region geometry in your drawing, but hopefully that won't be an issue (unless you alter the drawing boundaries) but this is more to show the idea. This method was the first that sprang to mind, but it is possible that using the hatches boundary polyline, could be adapted in a similar way.

Try it out and let me know how it goes.

 

Message 4 of 12
nikm42Q9N
in reply to: steven-g

This is deferentially on the right track i was attempting something like this when i wrote my original post, The problem i would have with it is adjusting the hatch to fit my shapes and my computer not being the newest or greatest tends to stutter when i mess with hatching. some are completed some are simple. But in the end this was all about saving time and i fell i can run through my original command string the way ive been doing.

 

I dont know much about LISP or Macros but how do download them and add them to CAD. But i was under the impression (and im  curious ) that a LISP is like programming a brand new command into auto cad using auto cads code. and a Macro was a series of recorded commands

 

So what i was thinking is i could record and  turn that command string into just one command. 

 

Thanks for the help just another reason to add to my list im making for my boss on why i want FULL Auto-Cad

Message 5 of 12
steven-g
in reply to: nikm42Q9N

That's the basic idea, a macro is a method to string commands together that you want to repeat often. In some ways I suppose Lisp is similar it allows for more options though than are available in LT (not that I have any idea how Lisp works). Here's a link for the how's of placing a macro in Autocad http://www.cad-notes.com/how-to-automate-autocad-with-command-macros/.

I have had an attempt at getting the field linked into a polyline, so that it can be used for the hatch boundary, and it looks promising, I'll post back when I can get it figured out, it will be a macro again and probably work with a block in a similar way to the last idea, so it would be worth your while to have a look at running macro's in LT.

Message 6 of 12
nikm42Q9N
in reply to: steven-g

I dont think the Marco is what i need after doing some research. what i really need is a LISP witch i cant use,

 

The whole Thing was to turn 5 line commands into one. i feel doing the macro and with blocks and what not would not only take longer but be more potential for errors. 

 

Thanks you for your help but i wouldn't put anymore effort into it. But if you do decide to go further i would be interested to see what you come up with 

Message 7 of 12
steven-g
in reply to: nikm42Q9N

A macro can do what you want, and as far as taking longer, it does it as quick as you can click, one click for each hatch, you don't even have to do anything with the blocks it's just a set up once and use forever setting. I know it sounds and looks a bit daunting, and it may well show up some issues to start with, because I have no idea how you work, or what your system is, but I promise you it's something you can do in your sleep.

 

I will update you, as this is actually something that I will be able to put to good use in my daily work.

Message 8 of 12
pendean
in reply to: nikm42Q9N

You will need to upgrade to full AutoCAD then grab one of these tools to do what you want then:
https://apps.autodesk.com/ACD/en/Detail/Index?id=2758261577526102910&appLang=en&os=Win32_64
https://apps.autodesk.com/ACD/en/Detail/Index?id=2045112649967645682&appLang=en&os=Win64
http://dotsoft.com/toolpac.htm (has many FIELD options.

Note that except for the first, not all are free either.
Message 9 of 12
nikm42Q9N
in reply to: steven-g

alright cool yea maybe im thinking of something different, ill be honest i was not able to download your file due to being on my work network. i plan to look at it later tonight. I am interested to see what you come up with

Message 10 of 12
steven-g
in reply to: nikm42Q9N

Wow looking at the prices in that last link Dean gave, I might think about starting to bottle some of the hundreds of macro's I've got laying around gathering dust, see if I can sell a few Smiley Very Happy

 

It took a bit of effort but I have it working, using the same principle of inserting a block, that has a polyline and a linked field, it then joins that polyline into your hatch boundary and reads the area of the polyline, after that it hatches that object.

 

Place the attached dwg in your support path or insert it as a block into a working drawing (anywhere out of the way - it's not important and you can delete it if you want because the block definition will be in the drawing)

 

Here's the macro to run it,

*^C^C^C-la;m;area;;rea;id;end;\change;end;$M=$(getvar,lastpoint);;p;la;area;;explode;end;$(getvar,lastpoint);-insert;*area2;end;$(getvar,lastpoint);1;0;-la;f;done;;pe;l;j;all;;;-la;t;done;;trim;end;$(getvar,lastpoint);;mid;$(+,50,$(index,0,$(getvar,lastpoint))),$(index,1,$(getvar,lastpoint));;-hatch;p;ansi37;;;s;p;;;

When you run the macro you will see A question mark appear at the cursor, pick a point on the hatch polyline boundary, and the area field appears and the boundary is hatched.

 

The following are just a few notes for things that may or may not cause some issues - macros don't really allow for error trapping. And if you find it doesn't work as expected then it could be for one of these reasons. Posting an example drawing would help and if you get errors then a copy of the command line history will help as well.

 

The size of units in your drawing will probably mean that a few thing will need changing to suit your needs - the block uses a polyline of 100 units and because Autocad macros are affected by zoom level, when you use macro's, if you are drawing objects at hundreds of unit sizes it should be fine but as that increases to hundreds of thousands then the block and macro may need updating (I often use a zoom function to solve this but it does drive you mad watching the screen flicker all over the place).

 

Because it uses coordinates based on the first point you pick, then it needs you to pick a point on the right hand side of a closed polyline, and there should be nothing to the right of that point for an area of about 100 units.

 

As I mentioned earlier it's impossible to foresee problems without knowing all the possible things in your drawing. A programming language like Lisp allows you to very precisely select objects, and use error trapping and get feedback from a user. A macro is basically a method to string a known and predictable sequence of commands together (and is limited in the length of the string it will accept)

 

Message 11 of 12
steven-g
in reply to: steven-g

Bigger, Stronger...

Actually a smaller more robust script, in a few circumstances I broke the other two, this version appears to work better, and uses the hatch to get the field area, 

*^C^Cid;\-insert;*area3;$M=$(getvar,lastpoint);1;0;-la;f;done;;-hatchedit;l;as;s;$(getvar,lastpoint);;;_la;t;done;;rea;
Message 12 of 12
nikm42Q9N
in reply to: steven-g

this will definitely work thanks, 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report