Creating Custom Tool

Creating Custom Tool

Anonymous
Not applicable
2,045 Views
12 Replies
Message 1 of 13

Creating Custom Tool

Anonymous
Not applicable

Hello all, I am an Autocad user with a basic understanding and knowledge of CAD and its tools, and i need some help creating a custom command prompt.

 

As a little background, I inspect the hulls and interiors of ships. Part of that inspection is taking measurements of the thicknesses of plate, and comparing those measurements to the original thickness of plate the ship was designed to have. Steel tends to rust and degrade over time, and it is my job to assess the condition of the vessel, and report any areas of concern so they may be repaired. I use AutoCad to make drawings of the ship structures that I inspect, and I am looking to have a command created that would increase the efficiency of reporting the measurements taken. What I am looking for is a command that I can input a number representing the design thickness of plate, then input my measurement taken, and the command would take those two numbers and give me an expression like the following:

 

 

 cad.jpg

For this example, I have a measurement of .440” on a plate that is originally .50”. The expression is two lines of text, justified Middle Center. The top line represents my measurement of the plate, .440”. The bottom line is the percentage of material difference of my reading from the original design thickness, within parenthesis. I currently have to edit two lines of text for each measurement I take, which takes all of fifteen seconds, but if I had a command that would do all the work, thousands of readings would be input much quicker, saving me time and my sanity.

 

 

The command prompt should be similar to the following. Note that text inside of hyphens are the command prompt given by AutoCad, text inside of parenthesis are my response to the prompt.

 

  1. -Enter original thickness of material-      (.50)
  2. -Enter thickness measurement taken-    (.440)
  3. -Select base point-

 

The top line of the expression would come from step 2 along with a ( “ ) suffix, and the bottom line would come from a calculation of steps 1 and 2, and have a ( % ) suffix, as well as rounding the decimal up or down. The calculation should  look something like:

 

(.50 - .44) / .50, or [(1)-(2)] / (1)

 

This is all a general idea, of course. There may be an easier way to do it, or the way that I have imagined it would be accomplished is completely incorrect. I have tried creating the command myself, but so far my attempts have proved futile.

 

The last step is to create four versions of this prompt, two versions being .05 and .07 font size in a standard measurement ("), and two versions being .05 and .07 font size metric measurement (mm).

 

  1. .07” font size w/inches suffix ( “ )
  2. .05” font size w/inches suffix ( “ )
  3. .07” font size w/metric suffix (mm)
  4. .05” font size w/metric suffix (mm)

 

 

Does anyone have a good idea of how to accomplish this, or guide me in the right direction? Thanks!

 

Keaton

0 Likes
Accepted solutions (1)
2,046 Views
12 Replies
Replies (12)
Message 2 of 13

devitg
Advisor
Advisor

Unzip and test , only first version , 0.07 and " 

 

 

COR-FACT   is the new command 

0 Likes
Message 3 of 13

krzysztof.psujek
Advocate
Advocate

Hi, welcome on forum.

If you don't know how to write simple routines maybe consider create blocks with attributes

and use fields, there is a possibility to set an expression in it and get result you want to.

Then result of such expressions could be formatted with some options (i.e. suffixes/prefixes, precision)

So it is great tool, I recomend you to get know it. 

 

Check example in drawing I've uploaded.

There are 2 blocks definitions, all done only with attribs and fields that correspond to another atts.

Just insert block where you want to and fill X and Y attribs values (I set it invisible)  

and rest are fields (will update its values after regen command).

 

Regards,

 

Chris

0 Likes
Message 4 of 13

scot-65
Advisor
Advisor
I am in favor of Krzysztof's suggestion with an added twist...
A block with 2 attributes and a DCL Dialog that the user selects
the various thickness (radio buttons), an edit field for actual
thickness and another cluster of radio buttons for the text format.
Select the OK button and insert the block.

MText could be used as well...

And Welcome to these Forums.

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes
Message 5 of 13

john.uhden
Mentor
Mentor
Just curious. I'm a wooden boat kinda guy (Barnegat Bay Sneakbox), but I wonder if you ever run into thicknesses greater than the design values, in which case you might need to represent the % difference as positive (+) vs. negative (-).

Anyway, wooden boats don't rust, but we often have the desire to sand them down a little extra (like with a belt sander and 36 grit) to make the boat fractionally lighter. Beaton Brothers in Mantoloking, NJ makes a very strong boat out of cedar, so sanding off an 1/8th inch wouldn't hurt its rigidity.

There used to be a fella 'round here named Bill Zondlo who works (worked?) for Lund Boats. Of course his interests were in design, not inspection.

John F. Uhden

0 Likes
Message 6 of 13

krzysztof.psujek
Advocate
Advocate

I meant do not new inserts but copy blocks with already defined fields.
Filling those two atrributes, that I marked below, isn't so complicated or much time consuming.
And much faster than mtexts you've ironic mentioned.

 

Block1.JPG

 

Of course it isn't best solution (routine will be much faster) but OP could do it by himself without any programming knowledge,

that was reason I've proposed it to him.

 

 

Chris

 

0 Likes
Message 7 of 13

Anonymous
Not applicable
I can only speak for steel, but generally there is a +/- tolerance when the plate is worked in the mill. An example would be that 1/2" sometimes varies in thickness from .505" - .495". The thickness measured is always compared to the original design thickness, so anything thicker than intended is noted as 0% wasted, regardless of condition.
0 Likes
Message 8 of 13

Anonymous
Not applicable
This is very close to what i'm looking to do. This is an AutoLisp routine? If so, where could i learn more about making them?

I appreciate the fact that you took the time to put this one together for me, Thank you!
0 Likes
Message 9 of 13

Anonymous
Not applicable
I see what you are saying, but i do think this isn't quite what i'm looking to do. I agree that a routine would be faster, any tips on where to start learning to write Autolisp routines?
0 Likes
Message 10 of 13

Kent1Cooper
Consultant
Consultant
Accepted solution

@Anonymous wrote:
.... any tips on where to start learning to write Autolisp routines?

A Search here [for terms like "learn Lisp" or "Lisp tutorials" or the like, and/or the same with AutoLisp] will find you absolutely    L   O   T   S    of threads raising the same question, with links and other varieties of suggestions.

Kent Cooper, AIA
0 Likes
Message 11 of 13

Anonymous
Not applicable
Thank you!
0 Likes
Message 12 of 13

devitg
Advisor
Advisor

Hi Keaton , yes it is a lisp , you have to load it , by appload , an the put 

 

cor-fact

a the command line , as cor-fact is a new ACAD command

 

To learn lisp is easy , you have to have a lot of CHAIR´S HOURS ,(like Pilots flying Hours) , dig at the forum , read sample lisp, and ASK ASK ASK ASK , but always SHOW SHOW SHOW, what are you doing , first and no last: THE DWG , second the task to do, and third te LISP you have done. 

 

http://www.afralisp.net/index.php

Is a good place to start 

 

 

Find attached my first ABC lisp,  I still use it 

 

see it here 

 

 

http://ronleigh.com/autolisp/

 

 

 

 

 

0 Likes
Message 13 of 13

Anonymous
Not applicable
Thank you!
0 Likes