Results 1 to 6 of 6

Thread: Manipulating dwgname variable in diesel field expression

  1. #1
    Member
    Join Date
    2015-09
    Location
    Vancouver
    Posts
    12
    Login to Give a bone
    0

    Default Manipulating dwgname variable in diesel field expression

    I have (with help from others) come up with a few diesel expressions I use in my borders. Both expressions grab data from the dwgname to populate attributes within my border.

    Typical drawing number

    07028-18D-34-030-RA.dwg

    The first grabs the first 16 characters (our drawing number) and places in the drawing number attribute.

    $(substr,$(getvar,dwgname),1,16)

    The second grabs only the 4th from the end character (our revision) and places in the drawing revision attribute.

    $(substr, $(getvar, dwgname),$(-,$(strlen, $(getvar, dwgname)),4),1)

    The third grabs only a portion out of the middle of the border (34) that we use for our area number.

    $(substr,$(getvar,dwgname),11,2)

    What I am having trouble with is finding a way (within diesel) to grab everything but the last 7 characters. In my example it would return the same value as my first example. However, sometimes our drawing number lengths differ and it would make sense to work from the end of the file to the front because the "-RA.dwg" will always be constant.

    Any help is appreicated and I hope the 3 expressions I've listed are useful to other users.

    ..g
    elea.lsp

  2. #2
    All AUGI, all the time zoomharis's Avatar
    Join Date
    2005-02
    Location
    Abu Dhabi (Native-India)
    Posts
    506
    Login to Give a bone
    0

    Default Re: Manipulating dwgname variable in diesel field expression

    Quote Originally Posted by gjp View Post
    What I am having trouble with is finding a way (within diesel) to grab everything but the last 7 characters. In my example it would return the same value as my first example. However, sometimes our drawing number lengths differ and it would make sense to work from the end of the file to the front because the "-RA.dwg" will always be constant.
    Use this expression
    $(substr,$(getvar,DWGNAME),1,$(-,$(strlen,$(getvar,DWGNAME)),7))

  3. #3
    Member
    Join Date
    2006-09
    Posts
    8
    Login to Give a bone
    0

    Default Re: Manipulating dwgname variable in diesel field expression

    this is really great!

    $(substr,$(getvar,DWGNAME),1,$(-,$(strlen,$(getvar,DWGNAME)),7))

    how about making this expression with results upper case?

  4. #4
    Certifiable AUGI Addict tedg's Avatar
    Join Date
    2005-06
    Location
    in the upper right corner
    Posts
    3,507
    Login to Give a bone
    0

    Default Re: Manipulating dwgname variable in diesel field expression

    Quote Originally Posted by kheajohn View Post
    this is really great!

    $(substr,$(getvar,DWGNAME),1,$(-,$(strlen,$(getvar,DWGNAME)),7))

    how about making this expression with results upper case?
    Try this:
    $(UPPER,$(SUBSTR,$(getvar,DWGNAME),1,$(-,$(strlen,$(getvar,DWGNAME)),7))
    I stole from this thread

  5. #5
    Member
    Join Date
    2006-09
    Posts
    8
    Login to Give a bone
    0

    Default Re: Manipulating dwgname variable in diesel field expression

    Try this:
    $(UPPER,$(SUBSTR,$(getvar,DWGNAME),1,$(-,$(strlen,$(getvar,DWGNAME)),7))
    I stole from this thread
    __________________
    Ted
    Those who master others have Force.
    Those who master themselves have Strength.

    i tried this before and does'nt work. Thanks.....anyone?

  6. #6
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,665
    Login to Give a bone
    0

    Default Re: Manipulating dwgname variable in diesel field expression

    Quote Originally Posted by tedg View Post
    Try this:
    $(UPPER,$(SUBSTR,$(getvar,DWGNAME),1,$(-,$(strlen,$(getvar,DWGNAME)),7))
    I stole from this thread
    Appears to be missing a closing parentheses at the end.

Similar Threads

  1. 2014: CUI Macro with Diesel Expression
    By ccarlson376355 in forum AutoCAD Customization
    Replies: 7
    Last Post: 2013-06-10, 08:39 PM
  2. Comparing tab name with expression in diesel
    By Phil Gravel in forum AutoCAD Customization
    Replies: 1
    Last Post: 2012-10-31, 07:46 PM
  3. Using a Diesel expression in a macro
    By barker_anthony in forum AutoCAD Customization
    Replies: 3
    Last Post: 2010-10-28, 06:16 PM
  4. Backslash in DIESEL expression?
    By christopherd in forum AutoCAD Customization
    Replies: 0
    Last Post: 2007-11-16, 08:17 AM

Posting Permissions

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