Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Distinguished Contributor
kameron1967
Posts: 186
Registered: ‎09-05-2008
Message 1 of 4 (209 Views)

Use userinput as block name

209 Views, 3 Replies
09-05-2012 07:44 AM

Hi,

 

I'm overlooking something really simple.  I wonder if someone can help me.  I just need the userinput to be incorporated in the insert command but don't know how to segregate the block name from the block path..

 

;;;PROMPT USER FOR BLOCK NAME HERE
(setq userinBLKNAME (getstring "\nPlease type in the block name shown in the allrevblocks - ex: IFCC4:"))

;;;INSERT BLOCK BASED ON BLOCK NAME PROVIDED HERE
(command "-insert" "B:\\CAD\\REVBLOCKS\\IFC\\"USERINBLKNAME PAUSE "1" "" "")

*Expert Elite*
azrdgldr
Posts: 1,250
Registered: ‎01-09-2007
Message 2 of 4 (207 Views)

Re: Use userinput as block name

09-05-2012 07:48 AM in reply to: kameron1967

I would personally string the block name and directory path together and stay away from the pause.  HTH.

*Expert Elite*
Kent1Cooper
Posts: 5,796
Registered: ‎09-13-2004
Message 3 of 4 (202 Views)

Re: Use userinput as block name

09-05-2012 09:06 AM in reply to: kameron1967

kameron1967 wrote:

....  I just need the userinput to be incorporated in the insert command but don't know how to segregate the block name from the block path..

 

;;;PROMPT USER FOR BLOCK NAME HERE
(setq userinBLKNAME (getstring "\nPlease type in the block name shown in the allrevblocks - ex: IFCC4:"))

;;;INSERT BLOCK BASED ON BLOCK NAME PROVIDED HERE
(command "-insert" "B:\\CAD\\REVBLOCKS\\IFC\\"USERINBLKNAME PAUSE "1" "" "")


(command

  "-insert"

  (strcat "B:\\CAD\\REVBLOCKS\\IFC\\" USERINBLKNAME)

  PAUSE "1" "" ""

)

 

But unless you might have different drawings with the same name in different filepath locations, you could just put that filepath in the Support File Search Path list, forget the variable, and just do:

 

(command "-insert" (getstring "\Block name from allrevblocks - ex: IFCC4: ") pause 1 "" "")

Kent Cooper
Distinguished Contributor
kameron1967
Posts: 186
Registered: ‎09-05-2008
Message 4 of 4 (179 Views)

Re: Use userinput as block name

09-05-2012 12:58 PM in reply to: Kent1Cooper

Thanks, Kent1Cooper!  I appreciate the quick help! :smileyhappy:

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!