Jump to content
samifox

add + operator to a formula that use field

Recommended Posts

samifox

hi

using acad 2017,

 

i use fields with object's Y position to read the current level.usualy is a relative level that start with 0.00

 

now i want to do the same but with absolute level,

 

 

for example , moving the level symbol and the associated text shows +0.10, i want autocad to add 290.10 to +0.10 reading so the total reading displays + 290.20

 

not sure how to do it?

 

Thanks in advance

S

Share this post


Link to post
Share on other sites
steven-g

When you are in the field dialogue, choose formula from the field names section, and in the formula entry box you can place your constant and use right click to enter another field (object). You can add or choose multiple fields within the formula, or diesel expressions so you can also access stored variables.

Field.jpg

Share this post


Link to post
Share on other sites
samifox

Thanks a lot Steven

Share this post


Link to post
Share on other sites
samifox

hi

using formula like 290.10+(-209.57/100) to show an absolute level works great till the designer called to ask to set the 0.00 to 286.60 instead of 290.10.

 

now i had created millions of copies to that field, that mean that i have to go 1 by 1 and to change them, manually?

how can i set a variable to hold my absolute value and still be able to use that formula?

Share this post


Link to post
Share on other sites
steven-g

You can use a diesel expression in one (or more) of the fields you use in the formula, and then all you need do is change the variable value with the setenv command, and it will update on regen, you might need to alter the Fieldeval variable fieldeval=31 to get the fields to update nicely.

 

 

Field3.jpg

Share this post


Link to post
Share on other sites
samifox
You can use a diesel expression in one (or more) of the fields you use in the formula, and then all you need do is change the variable value with the setenv command, and it will update on regen, you might need to alter the Fieldeval variable fieldeval=31 to get the fields to update nicely.

 

 

[ATTACH=CONFIG]61716[/ATTACH]

 

didnt tried it yet but you are the king !!!! thanks

Share this post


Link to post
Share on other sites
samifox

i test it, its great, i close and open cad so its saved with the drawing or with the Operation system? what happened when i open the same drawing in other pc?

setenv is an Autolisp function? getend is diesel ....how they interact?

Share this post


Link to post
Share on other sites
BIGAL

It sounds like it would be easier using normal text that is calculated of a base point then use something like our "add to levels lsp" to adjust all the required text.

Share this post


Link to post
Share on other sites
samifox

seems like the setenv store the value along with the drawing. is this the case?

Share this post


Link to post
Share on other sites
steven-g

Nope setenv is just a command to set an environmental variable and it is stored in the Windows registry, so it is not saved with the drawing it is the same value for all drawings. Looking a bit more it appears as though the setenv and getenv are unique to LT as command line functions (yeah one up for the LT guys), though it is available to full Autocad through Lisp and probably Diesel. You'll have to test that yourself, aren't there any easy accessible variables in full Autocad?

Another method would be to create a custom DWGPROPS value and this also becomes available in the field selection list (and is stored with the drawing)

Share this post


Link to post
Share on other sites
samifox

it seems like the drawing hold the value, i have restarted the pc and its still there

Share this post


Link to post
Share on other sites
BIGAL

What about a single text on a non plot layer change it, values change.

Share this post


Link to post
Share on other sites
steven-g

+1 BIGAL

I would have thought it would read it in as text and fail, but it works in the formula field just fine both text and mtext.

Share this post


Link to post
Share on other sites
samifox
Nope setenv is just a command to set an environmental variable and it is stored in the Windows registry, so it is not saved with the drawing it is the same value for all drawings. Looking a bit more it appears as though the setenv and getenv are unique to LT as command line functions (yeah one up for the LT guys), though it is available to full Autocad through Lisp and probably Diesel. You'll have to test that yourself, aren't there any easy accessible variables in full Autocad?

Another method would be to create a custom DWGPROPS value and this also becomes available in the field selection list (and is stored with the drawing)

 

hi steven

 

yaa set it a costume property as ABS and than get it in the field works better, now i can be sure its saved with the drawing

 

:)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×