See the top rated post in this thread. Click here

Results 1 to 7 of 7

Thread: Drop a simple line of text on the command prompt

  1. #1
    100 Club
    Join Date
    2007-05
    Location
    Fort Worth, Texas Cowtown USA
    Posts
    139
    Login to Give a bone
    0

    Default Drop a simple line of text on the command prompt

    I'm working on automating some of our drawings and everything is working great, I just want to drop the following line of text on the command prompt.

    NOW EDIT THE BHB PROJECT NUMBER

    In one of my lisps I use, it's formatted like this:
    Code:
    (PRINC "n-> NOW EDIT THE BHB PROJECT NUMBER")
    But I can't get this to work.

    Another way to get around this is to make the "BHB Project Number" automated which I haven't figured out how to do yet. Maybe someone out there knows how to help me with this and I can forget the "dropping a line of text on the command prompt".

    Our Network directories are as follows... E:\2007.000.000\2007.012.xxx\2007.012.075
    The last folder is where the drawings are located and it's also the project number. I'm needing just the last string of text (2007.012.075) without the forward slashes. Is there a way to access the folder name maybe through a field or a lisp? In the fields I have the option of "FileName", but it lists the entire path, not just the last folder.
    Last edited by ahefner; 2007-06-20 at 10:37 PM.

  2. #2
    Certified AUGI Addict jaberwok's Avatar
    Join Date
    2000-12
    Location
    0,0,0 The Origin
    Posts
    8,570
    Login to Give a bone
    0

    Default Re: Drop a simple line of text on the command prompt

    Quote Originally Posted by ahefner
    I'm working on automating some of our drawings and everything is working great, I just want to drop the following line of text on the command prompt.

    NOW EDIT THE BHB PROJECT NUMBER

    In one of my lisps I use, it's formatted like this:[code]
    (PRINC "\n-> NOW EDIT THE BHB PROJECT NUMBER")[code] But I can't get this to work.

    Another way to get around this is to make the "BHB Project Number" automated which I haven't figured out how to do yet. Maybe someone out there knows how to help me with this and I can forget the "dropping a line of text on the command prompt".

    Our Network directories are as follows... E:\2007.000.000\2007.012.xxx\2007.012.075\
    The last folder is where the drawings are located and it's also the project number. I'm needing just the last string of text (2007.012.075) without the forward slashes. Is there a way to access the folder name maybe through a field or a lisp? In the fields I have the option of "FileName", but it lists the entire path, not just the last folder.
    In the lisp, should you be using the "prompt" option with a "getxxx" function?

  3. #3
    100 Club
    Join Date
    2007-05
    Location
    Fort Worth, Texas Cowtown USA
    Posts
    139
    Login to Give a bone
    0

    Default Re: Drop a simple line of text on the command prompt

    I have no idea. I know VERY little about lisps.

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

    Default Re: Drop a simple line of text on the command prompt

    Here is a small bit of code to extract the last folder from the specified folder.
    Code:
    (defun lastfolder (path /)
      (setq folder (substr path 1 (1- (strlen path))))
      (while (vl-string-search (chr 47) folder)
        (setq folder (vl-string-subst (chr 92) (chr 47) folder))
        )
      (setq folder (substr folder (+ 2 (vl-string-position 92 folder 2 T))))
    )
    You will need to save this function to a file with a .lsp extension. You may even save it within your ACADDOC.LSP file if you have one. If you do not have one you could create it within a folder that is listed in your support path folder list.

    You would then call this function in this fashion.
    Code:
    (lastfolder foldername)
    Replace the foldername above with your desired folder. Remember to place the name within quotes (").

    To get the folder the drawing is located in, use the following.
    Code:
    (lastfolder (getvar "dwgprefix"))
    Your original request did not specify how you would actually use this. If you could elaborate a bit, someone here may be able to help you a little bit more.
    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
    100 Club
    Join Date
    2007-05
    Location
    Fort Worth, Texas Cowtown USA
    Posts
    139
    Login to Give a bone
    0

    Default Re: Drop a simple line of text on the command prompt

    I'm wanting something along the lines of a field which will read only the current folder name, not the entire path, so I can use that as my text (Ex: the current path is E:\2007.000.000\2007.012.xxx\2007.012.075\ and I want only the 2007.012.075)

    The current folder name is my project number which I need to put onto the drawing (it's within our logo. Currently as MTEXT which we edit every time). I wanting something that'll automatcially read the current folder name and display that as my text.

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

    Default Re: Drop a simple line of text on the command prompt

    I do not remember if 2006 allows you to place an AutoLISP variable into a text field. I'll have to look into it tomorrow at work if I have time. I do know that AutoCAD 2008 does allow an AutoLISP variable to be placed in a text field. You could run that command upon drawing startup to set the variable.

    Also, is this MTEXT part of a block?

    The code I posted earlier will require (vl-load-com) be executed first. Otherwise the code will error out and not provide you with the results you are expecting.
    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

  7. #7
    100 Club
    Join Date
    2007-05
    Location
    Fort Worth, Texas Cowtown USA
    Posts
    139
    Login to Give a bone
    0

    Default Re: Drop a simple line of text on the command prompt

    Quote Originally Posted by Opie
    I do not remember if 2006 allows you to place an AutoLISP variable into a text field. I'll have to look into it tomorrow at work if I have time. I do know that AutoCAD 2008 does allow an AutoLISP variable to be placed in a text field. You could run that command upon drawing startup to set the variable.

    Also, is this MTEXT part of a block?

    The code I posted earlier will require (vl-load-com) be executed first. Otherwise the code will error out and not provide you with the results you are expecting.
    The text can be within the block, or exploded, or an attribute or whatever it needs to be to work .

    I have no idea if or how to place an AutoLisp variable into a text field.

    And what is vl-load-com and how do I executed it?

    (thanks for the help btw)

    Sorry for taking so long to get back to you, I'm not receiving the e-mail notifications.

Similar Threads

  1. 2014: No Text at the Command Prompt...
    By jcb777 in forum ACA General
    Replies: 0
    Last Post: 2013-06-26, 10:14 PM
  2. Replies: 3
    Last Post: 2012-01-19, 05:59 PM
  3. Replies: 1
    Last Post: 2011-07-23, 01:53 AM
  4. Command Prompt Not Displaying any Text
    By matthew.kimball in forum AutoCAD General
    Replies: 6
    Last Post: 2008-05-21, 12:24 PM
  5. Missing text in command line
    By john.73967 in forum AutoCAD LT - General
    Replies: 1
    Last Post: 2004-08-29, 02:11 PM

Posting Permissions

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