Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: First 4 characters of Layout Tab with diesel expression

  1. #1
    Member
    Join Date
    2008-02
    Location
    North Seattle
    Posts
    42
    Login to Give a bone
    0

    Default First 4 characters of Layout Tab with diesel expression

    Can anyone help with this? I have searched and found how to link a field to CTAB system variable. I have even found someones code to get the LAST characters of the layout tab. I need to be able to link a field to the first 4 characters and another field to any characters AFTER the first 4. An example; a layout named "3.01 Elevations" would fill one field with 3.01 and another with Elevations. Any help would be greatly appreciated!

  2. #2
    Certifiable AUGI Addict ccowgill's Avatar
    Join Date
    2004-08
    Location
    Iron Station, NC
    Posts
    3,198
    Login to Give a bone
    0

    Default Re: First 4 characters of Layout Tab with diesel expression

    Quote Originally Posted by jmcbride.161140 View Post
    Can anyone help with this? I have searched and found how to link a field to CTAB system variable. I have even found someones code to get the LAST characters of the layout tab. I need to be able to link a field to the first 4 characters and another field to any characters AFTER the first 4. An example; a layout named "3.01 Elevations" would fill one field with 3.01 and another with Elevations. Any help would be greatly appreciated!
    what about using the substr command and grabbing each substring of the intial string, then passing each one to your diesel statement? I'm not very familiar with diesel, but I think it would work.
    Code:
    (setq str1 (substr (getvar "ctab") 0 4)
             str2 (substr (getvar "ctab") 4))

  3. #3
    Member
    Join Date
    2008-02
    Location
    North Seattle
    Posts
    42
    Login to Give a bone
    0

    Default Re: First 4 characters of Layout Tab with diesel expression

    I know it way less than you, but I think it is missing $ to make it work? When I copy and paste your code into acad I get "Invalid Field Code".

  4. #4
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,106
    Login to Give a bone
    0

    Default Re: First 4 characters of Layout Tab with diesel expression

    Chris, you need to convert it to diesel.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  5. #5
    AUGI Addict
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: First 4 characters of Layout Tab with diesel expression

    I'm no Diesel person...
    Code:
    $(substr, $(getvar,ctab), 1, 4)
    and
    Code:
    $(substr, $(getvar,ctab), 4)

  6. #6
    AUGI Addict
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: First 4 characters of Layout Tab with diesel expression

    Quote Originally Posted by ccowgill View Post
    what about using the substr command and grabbing each substring of the intial string, then passing each one to your diesel statement? I'm not very familiar with diesel, but I think it would work.
    Code:
    (setq str1 (substr (getvar "ctab") 0 4)
             str2 (substr (getvar "ctab") 4))
    BTW, with substr, you must start from 1. 0 will return an error.

  7. #7
    Member
    Join Date
    2008-02
    Location
    North Seattle
    Posts
    42
    Login to Give a bone
    0

    Default Re: First 4 characters of Layout Tab with diesel expression

    Quote Originally Posted by alanjt View Post
    I'm no Diesel person...
    Code:
    $(substr, $(getvar,ctab), 1, 4)
    and
    Code:
    $(substr, $(getvar,ctab), 4)
    Thanks so much!! These seemed to work perfect!

  8. #8
    AUGI Addict
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: First 4 characters of Layout Tab with diesel expression

    Quote Originally Posted by jmcbride.161140 View Post
    Thanks so much!! These seemed to work perfect!
    Right on! You're very welcome.

  9. #9
    Certifiable AUGI Addict ccowgill's Avatar
    Join Date
    2004-08
    Location
    Iron Station, NC
    Posts
    3,198
    Login to Give a bone
    0

    Default Re: First 4 characters of Layout Tab with diesel expression

    Quote Originally Posted by Opie View Post
    Chris, you need to convert it to diesel.
    I dont know anything about diesel, my thought was get the string using lisp, then convert the result to diesel, but Alan obviously knows what he is doing.

  10. #10
    Certifiable AUGI Addict ccowgill's Avatar
    Join Date
    2004-08
    Location
    Iron Station, NC
    Posts
    3,198
    Login to Give a bone
    0

    Default Re: First 4 characters of Layout Tab with diesel expression

    Quote Originally Posted by alanjt View Post
    BTW, with substr, you must start from 1. 0 will return an error.
    you are right, I mis-read the help file when I was looking up the proper syntax for substr.

Page 1 of 2 12 LastLast

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
  •