+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14
  1. #1
    Super Member
    Using
    AutoCAD 2010
    Join Date
    Dec 2010
    Posts
    1,164

    Default add + operator to a formula that use field

    Registered forum members do not see this ad.

    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

  2. #2
    Forum Deity steven-g's Avatar
    Computer Details
    steven-g's Computer Details
    Operating System:
    Win 7
    Discipline
    Construction
    steven-g's Discipline Details
    Occupation
    Draughtsman
    Discipline
    Construction
    Details
    I work in the estimating department of a large building contractor.
    Using
    AutoCAD 2017
    Join Date
    May 2013
    Location
    An Englishman in Belgium
    Posts
    2,042

    Default

    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

  3. #3
    Super Member
    Using
    AutoCAD 2010
    Join Date
    Dec 2010
    Posts
    1,164

    Default

    Thanks a lot Steven

  4. #4
    Super Member
    Using
    AutoCAD 2010
    Join Date
    Dec 2010
    Posts
    1,164

    Default

    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?

  5. #5
    Forum Deity steven-g's Avatar
    Computer Details
    steven-g's Computer Details
    Operating System:
    Win 7
    Discipline
    Construction
    steven-g's Discipline Details
    Occupation
    Draughtsman
    Discipline
    Construction
    Details
    I work in the estimating department of a large building contractor.
    Using
    AutoCAD 2017
    Join Date
    May 2013
    Location
    An Englishman in Belgium
    Posts
    2,042

    Default

    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
    I've just been down graded from 2012LT to full Autocad 2017. I WANT LT BACK

  6. #6
    Super Member
    Using
    AutoCAD 2010
    Join Date
    Dec 2010
    Posts
    1,164

    Default

    Quote Originally Posted by steven-g View Post
    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.


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

  7. #7
    Super Member
    Using
    AutoCAD 2010
    Join Date
    Dec 2010
    Posts
    1,164

    Default

    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?

  8. #8
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,745

    Default

    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.
    A man who never made mistakes never made anything

  9. #9
    Super Member
    Using
    AutoCAD 2010
    Join Date
    Dec 2010
    Posts
    1,164

    Default

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

  10. #10
    Forum Deity steven-g's Avatar
    Computer Details
    steven-g's Computer Details
    Operating System:
    Win 7
    Discipline
    Construction
    steven-g's Discipline Details
    Occupation
    Draughtsman
    Discipline
    Construction
    Details
    I work in the estimating department of a large building contractor.
    Using
    AutoCAD 2017
    Join Date
    May 2013
    Location
    An Englishman in Belgium
    Posts
    2,042

    Default

    Registered forum members do not see this ad.

    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)
    I've just been down graded from 2012LT to full Autocad 2017. I WANT LT BACK

Similar Threads

  1. Formula field IF statement
    By Amail in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 25th Feb 2016, 09:01 pm
  2. AutoCAD Formula Field Plot issue
    By Shoey in forum AutoCAD General
    Replies: 0
    Last Post: 23rd Nov 2015, 06:37 pm
  3. Create a leader with a formula & field within via vba
    By dan_g8 in forum .NET, ObjectARX & VBA
    Replies: 0
    Last Post: 27th Oct 2014, 01:53 pm
  4. Problem with Formula Field in Dynamic Block
    By robwalker24 in forum AutoCAD Drawing Management & Output
    Replies: 4
    Last Post: 13th Sep 2010, 02:44 pm
  5. Decimal places in Formula Field in a Table
    By dabatman in forum AutoCAD Drawing Management & Output
    Replies: 2
    Last Post: 6th Feb 2008, 05:45 am

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts