I have a routine to wblock out items selected to a file, the code is:
(DEFUN C:TTT ( / SS PICKPT tempdrawing) (SETQ SS (SSGET "I")) (SETQ PICKPT (getpoint "\nPick Insert Point")) (setq tempdrawing "C:\\TEMP\\JAMES.DWG") (command "export" tempdrawing PICKPT) (command "OOPS") )
When I run that (with some lines selected first), it does not work. It asks me to select objects at the end.
If I comment out the (command "oops") line, it works.
The code above is not my whole prog, just a test, but it narrows down the issue I am seeing.
Any ideas how to make it work with the oops present?
internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties
Solved! Go to Solution.
Solved by Moshe-A. Go to Solution.
what do you mean by end?
What woiuld that var be set to?
internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties
Try replacing the line
(command "export" tempdrawing PICKPT)
with this one:
(command "_export" tempdrawing PICKPT end)
JMaeding,
; this the fix you need
(command "export" tempdrawing PICKPT ss)
but what's the point in using EXPORT instead of WBLOCK?
Moshe
is anyone trying what they suggest?
_export has no effect, and the last post tells me to add the SS to the command.
Clearly they did not read my post which says to pick items first.
The issue does not happen if you pick after, I am aware of that.
I believe the _export is a thing you do when dealing with people not using english.
.export is when a command may be undefined.
I posted example code because I would not have believed there would be a problem with running another command after, but it affects things.
I stopped using wblock a long time ago, I think because it asked about exporting map data or something.
I used to use it though, this WTIT.lsp I am dealing with is a very old routine, I have modified it through the years and ran into this pickfirst issue recently.
internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties
James,
After doing some investigations i discovered that calling (command "export") has a two behaviours
(i think it's a bug) depending on (ssget) function call:-
a. (command ".export" fname ins ss "" "" "oops")
if you call (ssget "i") with the implied selection? then the (command) function after getting the file name
does not issue the prompt:-
[= (block=output file)/* (whole drawing)] <define new drawing>:
instead it issue the prompt:-
insertion base point:
so the insertion point argument must be given there next the ss argument is given and next is the enter
argument to complete the selection set but autocad does not satisfy with it and another enter
is needed to complete the selection set next comes the OOPS command.
b. (command ".export" fname "" ins ss "" "oops")
if you call (ssget) neat? the behaviour of the command is normal as it sould be.
but i do not understand why it's makes so different to you to only use (ssget "i")? cause if you invoke
TTT command without pre selecting objects your command will fail. does it matter if you first select objects
or activate TTT and do the selection?
so i did cover this situation for you and now it will work either way.
Cheers
Moshe
(defun c:ttt (/ fname ss ins) (defun askPoint () (setq ins (getpoint "\nInsertion base Point: ")) ) (setq fname "C:\\TEMP\\JAMES.dwg") (if (setq ss (ssget "i")) (if (askPoint) (command ".export" fname ins ss "" "" "oops") ); if (if (setq ss (ssget)) (if (askPoint) (command ".export" fname "" ins ss "" "oops") ); if ); if ); if (princ) )
My testing does not agree with your idea of adding ss "" "" to the situation where items are picked first.
Simply do this to see:
draw a line, and grip it (select it).
issue this at command line:
(COMMAND "EXPORT" "JAMES.DWG" (GETPOINT))
It works fine.
see how it does not ask for a selection set?
now try this to see it fail:
(COMMAND "EXPORT" "JAMES.DWG" (GETPOINT) "OOPS")
that "oops" messes it up, for no logical reason I can tell.
See if your tests agree.
internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties
2009, 2011, 2012, 2013 they all behave the same.
I have ADN membership so many versions installed.
internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties
OK i see the problem but
just wonder if (ssget) solved it why not use it?
I would, I am just not sure what its really doing.
Your code exits with an error, though it seems to work.
I will try a couple things first, mainly (command "select" "") to see if I can get it down to one3 case at the export step.
thanks a bunch for your thoughts on this so far!
internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties
I get this:
Command: ttt
Insertion base Point: Unknown command "TTT". Press F1 for help.
I am not sure why it gives that since TTT is defined. It should have failed on the SS param.
I'll probably just use that as the error seems benign.
internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties
I agree, and worry a bit about what that might do in certain situations.
It was your extra enter though 🙂
There is some bug going on, as simply adding "oops" after the command messes it up.
It works fine when you type it, just not in the flow of lisp.
internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties
OK,
i removed the extra enter, does it's works now?
moshe
(defun c:ttt (/ fname ss ins) (defun askPoint () (setq ins (getpoint "\nInsertion base Point: ")) ) (setq fname "C:\\TEMP\\JAMES.dwg") (if (setq ss (ssget "i")) (if (askPoint) (command ".export" fname ins ss "" "oops") ); if (if (setq ss (ssget)) (if (askPoint) (command ".export" fname "" ins ss "" "oops") ); if ); if ); if (princ) )
yah, it does. I am sure I tried that before, here is revised test code:
(DEFUN C:TTT ( / SS PICKPT tempdrawing james) (SETQ SS (SSGET "I")) (SETQ PICKPT (getpoint "\nPick Insert Point")) (setq tempdrawing "C:\\TEMP\\tempp.DWG") (command ".export" tempdrawing PICKPT SS "" "OOPS") )
I will have to look back over what I did before, as I must have fooled myself that I tried it.
Maybe the fact that it behaves differently in lisp than on command line tricked me, but it seems its working now.
Thanks again.
internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties
I posted the WTIT.lsp in a new thread, if you want to see the results of our labor.
internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties
Can't find what you're looking for? Ask the community or share your knowledge.