benhubel Posted April 11, 2016 Share Posted April 11, 2016 I am stuck on the syntax to write a block without user input. On executing the lisp, I want it to get a selection set from a variable and then write it to a new block without asking the user for input. The basepoint can be "0,0,0" and the file path is a pre-set path. The general command I'm trying to use goes like this (I know it's wrong, but I don't know where to go from here) (command "-wblock" "C:\\Users\\DefaultUser\\Desktop\\ScriptTest\\Blocktest1.dxf" "0,0,0") I've searched LISP routines all over the place but can't find one that does this. I'm mostly looking for examples that contain a similar line of code. Quote Link to comment Share on other sites More sharing options...
David Bethel Posted April 11, 2016 Share Posted April 11, 2016 1) I don't think that you can WBLOCK to a dxf format. 2) To export as a new block try : (command "_.WBLOCK" file_name "" '(0 0 0) 'pickset "") If you need to retain the entities (command "_.OOPS") -David Quote Link to comment Share on other sites More sharing options...
benhubel Posted April 11, 2016 Author Share Posted April 11, 2016 I'm having trouble making that work. I tried testing it out in a new file in VLIDE. The console history is: 3 found_.WBLOCK Enter name of output file: C:\Users\DefaultUser\Desktop\ScriptTest\\Blocktest1.dwg Enter name of existing block or [= (block=output file)/* (whole drawing)] : Specify insertion base point: Select objects: ; error: bad argument value: AutoCAD command: PICKSET here's what I have so far. Is there something I'm doing wrong? (defun c:testingwb () (setq pickset (ssget)) (setq file_name "C:\\Users\\DefaultUser\\Desktop\\ScriptTest\\Blocktest1.dwg") (command "_.WBLOCK" file_name "" '(0 0 0) 'pickset "") (command "_.OOPS") ) As a side note, I'm in love with the command: (command "_.OOPS") It's great fun. Quote Link to comment Share on other sites More sharing options...
David Bethel Posted April 11, 2016 Share Posted April 11, 2016 (edited) Because you used (setq pickset (ssget)) you do not use the single ' with any references to the variable (set 'picksert ...) vs (setq pickset ...) vs (set (quote pickset...)) vs (set (read "PICKSET") ....) HTH -David Oh WOW That was my BAD in post #2 Sorry ! That will teach me not to test snippets of code ! Edited April 11, 2016 by David Bethel Quote Link to comment Share on other sites More sharing options...
rkmcswain Posted April 11, 2016 Share Posted April 11, 2016 The following works for me in 2014. The second function will let you export a selection set to DXF. (defun c:testingwb () (setq pickset (ssget)) (setq file_name "C:\\temp\\Blocktest1.dwg") (command "_.WBLOCK" file_name "" (list 0.0 0.0 0.0) pickset "") (command "_.OOPS") ) (defun c:dxfobj ( / pickset filename) (setq pickset (ssget)) (setq file_name "C:\\temp\\Blocktest1.dxf") (vl-cmdf "_.dxfout" file_name "_O" pickset "" "16") ) Quote Link to comment Share on other sites More sharing options...
benhubel Posted April 11, 2016 Author Share Posted April 11, 2016 Greatness has been beheld on this day. Thank you very much, both of you! I am one step closer to sanity. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.