See the top rated post in this thread. Click here

Results 1 to 7 of 7

Thread: Need help to understand spaces in routines

  1. #1
    Member
    Join Date
    2005-11
    Location
    Daly City, Ca.
    Posts
    41
    Login to Give a bone
    0

    Default Need help to understand spaces in routines

    Need clarification on what exactly goes into spaces in lisp routines. Are there tips out there on how to determine how to write a routine where part of the routine has to have a regular space on the line. How does one determine which route to take if part of his/ her routine will include regular spaces so that autocad won't read them as returns.

    I'm trying to write a routine for importing pagesetups into a drawing. When I type everthing in the command line, it works fine but when I transpose those into a routine, it doesn't because my pagesetups have spaces on them. spaces = returns in the routine.

    I can easily just rename the setups to not include space but i'd like to find out what the common practice is for spaces. Do we just avoid spaces on filenames, folder names or anything we can use w/ the file from pagesetups to layout names and layers in general?

    Here's what i've tried so far from past suggestions on other routines i've tried out but i think these work w/ attribute fields and not for what i'm trying to use it for which are in the command line prompts. Then again i'm a newbie and i can just be messing this thing up completely. Any suggestions on how to do this line properly or a different way? Any input would help?

    Code:
      
    (write-line (strcat "-psetupin" "\r" "Q:/DRAFTING_STANDARDS/PAGE_SETUP/PS.DWG" "\r" "CA8306101 - B SIZE 1 TO 1" "\R") SCRFILE)
     
    (write-line "-psetupin Q:/DRAFTING_STANDARDS/PAGE_SETUP/PS.DWG \"CA8306101 - B SIZE 1 TO 1\"" scrfile)
     
    (write-line (strcat "-psetupin Q:/DRAFTING_STANDARDS/PAGE_SETUP/PS.DWG" 
       "\NCA8306101 - B SIZE 1 TO 1")
      scrFile
      )

  2. #2
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: Need help to understand spaces in routines

    I started with computers when MS-DOS 3.0 was hot, and I am still allergic to spaces, special characters and filenames that are not in 8.3 formats.

    Your problem is NOT lisp, your problem is the script you are using.
    If you manually can type the line at the Command prompt it will also work in script, otherwise not.

    If you turn it in to Lisp, the problem is no more a problem.

    : ) Happy Computing !

    kennet

  3. #3
    I could stop if I wanted to
    Join Date
    2015-08
    Posts
    263
    Login to Give a bone
    1

    Default Re: Need help to understand spaces in routines

    Quote Originally Posted by sumulong
    Any input would help?
    I would suggest you to split the lines in the script file. If any prompt is likely to accept spaces, then cover it with double quotes. This is applicable for file names too. The following code shows how to do this. (I removed the underscore from your path, but keep them back if you need it).
    Code:
    (write-line "-psetupin" scrfile)
    (write-line (strcat (chr 34) "Q:/DRAFTING STANDARDS/PAGE SETUP/PS.DWG" (chr 34) ) scrfile)
    (write-line (strcat (chr 34) "NCA8306101 - B SIZE 1 TO 1" (chr 34)) scrfile)
    Regards,
    Abdul Huck

  4. #4
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: Need help to understand spaces in routines

    If you still want to use the script file, I recommend you to combine lisp and script like this :

    (write-line "(command \42-psetupin\42 \42Q:/DRAFTING STANDARDS/PAGE SETUP/PS.DWG\42 \42NCA8306101 - B SIZE 1 TO 1\42 )" scrfile )

    : ) Happy Computing !

    kennet

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

    Default Re: Need help to understand spaces in routines

    Under "File => Plot Utilities => Page Setups" I've added a group of items with macros like:

    (command "._-PSETUPIN" "acad.dwt" "755cm B&W Layout")

    Just an alternitive to lisp or scripts. Never had a problem with spaces inside of quotes.

  6. #6
    Member
    Join Date
    2005-11
    Location
    Daly City, Ca.
    Posts
    41
    Login to Give a bone
    0

    Default Re: Need help to understand spaces in routines

    Thanks to all who responded. All your suggestions work!

    Just a quick clarification on somethings. Is \42 a different way to show " " or are the 2 totally different? Seems like \42 just inputs whatever is in-between them into the command line as is. I'm getting the impression that " " do the same thing?

    Again thanks a bunch.

  7. #7
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: Need help to understand spaces in routines

    Check my last post once more, you need “outer” and “inner” quotation marks, but sometimes you can’t use them as you are used to. Then you have to use different “outer” and “inner” quotation marks

    Here is a few different ways to deceive AutoCAD when needed:
    Code:
    (write-line "(command \"-psetupin\" \"Q:/DRAFTING STANDARDS/PAGE SETUP/PS.DWG\" \"NCA8306101 - B SIZE 1 TO 1\" )" scrfile )
    
    (write-line "(command \42-psetupin\42 \42Q:/DRAFTING STANDARDS/PAGE SETUP/PS.DWG\42 \42NCA8306101 - B SIZE 1 TO 1\42 )" scrfile )
    
    (write-line (strcat "(command "(chr 34)"-psetupin"(chr 34)" "(chr 34)"Q:/DRAFTING STANDARDS/PAGE SETUP/PS.DWG"(chr 34)" "(chr 34)"NCA8306101 - B SIZE 1 TO 1"(chr 34)" )" ) scrfile )
    you just describe the same character in different “languages” when needed.


    : Happy Computing !

    kennet

Similar Threads

  1. Spaces to cope with vertically irregular spaces better
    By Wish List System in forum Revit MEP - Wish List
    Replies: 2
    Last Post: 2015-12-05, 08:10 PM
  2. CP122-1: CUI: You Can Understand It!
    By Autodesk University in forum Customization and Programming
    Replies: 0
    Last Post: 2014-12-01, 01:44 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
  •