Anuncios

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Dim Field lisp help

minh.dxuan
Enthusiast

Dim Field lisp help

minh.dxuan
Enthusiast
Enthusiast

Dea all, 

 

Lee Mac has AF and LF to replace for existing text by field as below:

http://www.lee-mac.com/lengthfield.html#lf

I need to similar lisp to get value of existing linear dimension in drawings and replace for an existing text.

Thank you so much in advance.

0 Me gusta
Responder
Soluciones aceptadas (3)
2.100 Vistas
13 Respuestas
Respuestas (13)

Moshe-A
Mentor
Mentor

@minh.dxuan  hi,

 

Attached a lisp command called RDD to do what you want. place the file (rdd.vlx) in your lisp folder and load it. type rdd to run.

 

for dimension it accept any type of dimension.

for text it accept text + mtext. if you pick mtext be aware the whole text value is replaced by the dim value.

 

the result text format is comply with the selected dimension dimstyle. if the selected dimension has dimension overrides, they will not affect the result.

 

enjoy

moshe

 

 

 

 

 

 

 

minh.dxuan
Enthusiast
Enthusiast

Dear Moshe,

 

Thank you so much for your help. Sorry because I forgot to describe more detail about the requirements:

1. Existing text will be replaced by value of 1 dim or total value of some dims.

2. Unit displays on dim is mm, value to be replaced is m. Therefore, the value after replacing = value of dims/1,000 (round 2 numbers after decimal point).

3. The replacement must be field so that when I adjust dim length and run command "re", the field will be automatically updated as the attached photo.

 

screenshot_1600006548.png

 

Many thanks.

0 Me gusta

Moshe-A
Mentor
Mentor

@minh.dxuan ,

 

1 + 2 fixed

 

about 3:

i do not think field has an option to hold\reference more than 1 object and even referencing 1, i could not find the option to reference dimension value.  of course this could be solved by autolisp but it requires more coding, so at the mean time re-invoke rdd to update the text object.

 

enjoy

Moshe

 

minh.dxuan
Enthusiast
Enthusiast

Dear Moshe,

 

I am really happy when getting your help. The item No.03 is very important. I would like to attach 2 lisps that you can refer and maybe you can apply their codes to update for item No.03.

AF/LF (AF: Area summary replaces to Field on existing text; LF: Length summary replaces to Field on existing text).

D2F (Dim summary to Field by picking to place the new text).

 

Many thanks for your help.

0 Me gusta

Moshe-A
Mentor
Mentor

@minh.dxuan 

 

fixed

 

 

minh.dxuan
Enthusiast
Enthusiast

Dear Moshe,

 

From bottom of my heart, I would like to thank you for your help you gave me. About the last lisp (D2F) you sent to me. I think it still has a very small mistake so that I can not get the result when I run D2F. Could you please help me to check this file?

 

Thank you so much.

0 Me gusta

Moshe-A
Mentor
Mentor

to see the 'mistake' post a sample dwg 

minh.dxuan
Enthusiast
Enthusiast

Dear Moshe,

 

Please try to apply D2F to combine 2 lengths in drawing to replace to the pointed "-".

 

Thank you so much and best regards.

0 Me gusta

Moshe-A
Mentor
Mentor
Solución aceptada

@minh.dxuan ,

 

sorry my mistake, here is the fix

 

 

 

minh.dxuan
Enthusiast
Enthusiast

Dear Moshe,

 

It's so great that you already fixed that error. Could you please again fix the item No.02 as below?
"2. Unit displays on dim is mm, value to be replaced is m. Therefore, the value after replacing = value of dims/1,000 (round 2 numbers after decimal point)."

 

Thank you so much and best regards.

0 Me gusta

Moshe-A
Mentor
Mentor
Solución aceptada

@minh.dxuan ,

 

ok, fixed.

 

About "round 2 numbers after decimal point" you can control it with UNITS length precision (luprec sysvar). cause we are talking on field this will update them all.

 

i have notice that (after D2F) some times the text value is 'messed' or the field is  vanished and  a second try fix it. after experimenting with it i feel (not sure) that this is FIELD problem and not the lisp so be aware of that.

 

Moshe

 

 

minh.dxuan
Enthusiast
Enthusiast

Dear Moshe,

 

Now it works very well and I would like to thank you for your important helping. I am sure that your this lisp help many other peoples.

 

Best regards.

0 Me gusta

Moshe-A
Mentor
Mentor
Solución aceptada

i am very glade i could help - have a nice day :cara_sonriente: