Jump to content

REQUEST LISP CODE


hosyn

Recommended Posts

Hello guys

I need code lisp to create a empty file text in current folder as the following pic:

1-GET INPUT TEXT LIKE "AAA"

2-CREATE EMPTY TEXT FILE 

thank you in advance for any helping.

 

 

 

 

 

Capture.JPG

Edited by hosyn
Link to comment
Share on other sites

  • Prompt the user for a string using the getstring function
  • Obtain the path of the current drawing using the DWGPREFIX system variable
  • Obtain the drawing filename using the DWGNAME system variable
  • Obtain the value of these system variables using the getvar function
  • Obtain the filename without the extension using the vl-filename-base function
  • Concatenate the filepath, filename, "---", user string, and ".txt" extension using the strcat function
  • Create the text file using the open function with the "w" argument (to open for writing)
  • Close the text file using the close function
Edited by Lee Mac
  • Thanks 1
Link to comment
Share on other sites

continued... 

  • Obtain the knowledge by posting in CADTutor AutoLISP, Visual LISP & DCL
  • At least put an effort to write a code and asked for advice / suggestions when you hit a wall. [ The best way to learn ]
  • Search the forum for similar topic  first before posting a request.
  • Avoid starting a new topic when things does'nt go your way on an un-resolved issue from another topic that you started

 

  • Thanks 1
Link to comment
Share on other sites

HI TO ALL

APPRECIATE FOR ALWAYS AIDED, I LIKE YOU ALL SO MUCH.

I TRIED TO CREATE TILL*️⃣

(defun c:crytxt(/)
 (vl-load-com)
(setq AAA (getstRING "tell ---AAA"))           ;;;Prompt the user for a string using the getstring function
(setq PATHF (getvar "dwgprefix"))             ;;;Obtain the path of the current drawing using the DWGPREFIX system variable
(setq DWGN  (getvar "dwgNAME" ))                 ;;;Obtain the drawing filename using the DWGNAME system variable
                                      ;;;Obtain the value of these system variables using the getvar function
(setq DWGNNN (vl-filename-base DWGN)) ;;;Obtain the filename without the extension using the vl-filename-base function
(STRCAT PSTHF DWGN "---" AAA ".TXT"  );;;Concatenate the filepath, filename, "---", user string, and ".txt" extension using the strcat function
))

ANY RECOMAND !!!

Link to comment
Share on other sites

if you're wondering why it showing the error.

; error: bad argument type: stringp nil

... you mispelled one variable at your strcat statment

and you are almost there..

 

 

 

 

  • Like 1
Link to comment
Share on other sites

Also this and fixed 3 errors you had 2 brackets at end and wrong filename.


 

(setq fname (STRCAT PATHF DWGNNNN "---" AAA ".TXT" ) "w")
)

 

  • Thanks 1
Link to comment
Share on other sites

Thank you to all with your guide this issue solved perfectly '

NOW IN CONTINUE IF I WANT TO SEARCH DWG AND TXT RELATED TOGATHER AND RENAMINIG ALL SAME AS  (*******.DWG) FILE WITH (******-AAA.TXT) .WHAT  YOU RECOMMEND ME.

Edited by hosyn
Link to comment
Share on other sites

THANK YOU ALL , EVERYTHING BEING OKEY,😍

Is there anyway to export this information of dwg to SQLLIGHT. Anyone here have that experience ??

Edited by hosyn
Link to comment
Share on other sites

8 hours ago, hosyn said:

Is there anyway to export this information of dwg to SQLLIGHT. Anyone here have that experience ??

 

Sounded like a light alcoholic beverage to me, in that case Yes I do have expererience. but i'm sure we are NOT referring to the same thing 🙂

 

- - - PLEASE DRINK RESPONSIBLY - - - 

 

Edited by pBe
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...