Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

DXFOUT Select Objects

9 REPLIES 9
Reply
Message 1 of 10
Anonymous
3386 Views, 9 Replies

DXFOUT Select Objects

Hi all,

I have the following problem:

I want to write a lisp that makes a dxf file of some objects in my drawing. To do this i
1 type dxfout (then the save as dialog appears)
2 put a name there
3 go to options
4 make sure that the cross of 'select objects' is on
5 then select the objects en then i am finished.

Is there a simpele way to make a lisp of this. On this forum i've read some discussions but nobody knows it.

Some people say that i had to do this:

filedia 0
dxfout
(name)
O (select object)
...
filedia 1

I don't what that because then i can't search for the folder to put the dxf file in, you only get information on the command line.

I need to have the normal (saveas) window but then the select objects cross needs to be there automaticly.

I hope i have write it down so people understand me.

I'm using autocad 2008-2010.

Daniel
9 REPLIES 9
Message 2 of 10
Anonymous
in reply to: Anonymous

How about WBLOCK or -WBLOCK?
Message 3 of 10
Anonymous
in reply to: Anonymous

Wblock works, but not perfectly. If you use this command you always have to type *.dxf after the file name. Isn't it possible with dxfout, somebody made the command so it should work...
Message 4 of 10
Kent1Cooper
in reply to: Anonymous

Try this:

{code}
(command
"_.dxfout"
(getfiled "DXF File:" "X:/Your/File/Path/" "dxf" 1)
"_Objects"
(ssget)
"" ; completes selection
"" ; non-default number or other option if desired, with followup line(s) if necessary
); end command
{code}

Put in a likely starting-point folder [or just a drive] in the file path part, but you can navigate from there to wherever you want to put it.

It doesn't use the regular SaveAs dialog box with a select-object check-box, but rather uses a (getfiled) dialog box only to establish the file name and location, and then just takes you right into selecting objects. And it doesn't change the filedia setting.

--
Kent Cooper


drschonf wrote...
....
I want to write a lisp that makes a dxf file of some objects in my drawing.
....
filedia 0
dxfout
(name)
O (select object)
...
filedia 1

I don't what that because then i can't search for the folder to put the dxf file in, you only get information on the command line.

I need to have the normal (saveas) window but then the select objects cross needs to be there automaticly.
....
Kent Cooper, AIA
Message 5 of 10
Anonymous
in reply to: Anonymous

Excellent code Ken1Cooper.

And if the OP would like the dialog to always point to the current file
path:

(getfiled "DXF File:" (getvar"dwgprefix") "dxf" 1)

Paul

wrote in message news:6229368@discussion.autodesk.com...
Try this:

{code}
(command
"_.dxfout"
(getfiled "DXF File:" "X:/Your/File/Path/" "dxf" 1)
"_Objects"
(ssget)
"" ; completes selection
"" ; non-default number or other option if desired, with followup line(s)
if necessary
); end command
{code}

Put in a likely starting-point folder [or just a drive] in the file path
part, but you can navigate from there to wherever you want to put it.

It doesn't use the regular SaveAs dialog box with a select-object check-box,
but rather uses a (getfiled) dialog box only to establish the file name and
location, and then just takes you right into selecting objects. And it
doesn't change the filedia setting.

--
Kent Cooper


drschonf wrote...
....
I want to write a lisp that makes a dxf file of some objects in my drawing.
....
filedia 0
dxfout
(name)
O (select object)
...
filedia 1

I don't what that because then i can't search for the folder to put the dxf
file in, you only get information on the command line.

I need to have the normal (saveas) window but then the select objects cross
needs to be there automaticly.
....
Message 6 of 10
Kent1Cooper
in reply to: Anonymous

A very good suggestion, if they store files organized the way we do. If they have a separate folder for DXF files within a given project or something, it's probably a sub-folder under the current one, or at the same "level" as the current one under the one above, or otherwise a nice short navigate away from the current one. So the current folder could be a better place to start navigating from than some more generic location.

--
Kent Cooper


A+P wrote...

And if the OP would like the dialog to always point to the current file
path:

(getfiled "DXF File:" (getvar"dwgprefix") "dxf" 1)
Kent Cooper, AIA
Message 7 of 10
Anonymous
in reply to: Anonymous

Thank you all!!!. This does the job.

I'm now using this lisp:

>(defun c:dxo ()
>(command "cmdecho" 0)
>(command "_.dxfout"
> (getfiled "DXF File:" (getvar"dwgprefix") "dxf" 1)
> "_Objects" (ssget)
> "" ; completes selection
> "" ; non-default number or other option if desired, with followup line(s)
> if necessary
> ); end command
> (command "cmdecho" 1)
>)

Question, after i used the command i get this error message (the lisp works!!!)

>Command: DXO
>Select objects: 1 found
>Select objects: ; error: bad argument value: AutoCAD command: #
>@0000000028c5d610 IF>

Is there a possibility to get ride of that message. I used 'cmdecho 0', but is still there.

Daniel
Message 8 of 10
CraigP_
in reply to: Anonymous

I beleive this should be all on one line

{color:#ff0000}"" ; non-default number or other option if desired, with followup line(s) if necessary{color}

I like this lisp file , but how can I set the version to R12?


Craig


> {quote:title=drschonf wrote:}{quote}Thank you all!!!. This does the job.
>
> I'm now using this lisp:
>
> > (defun c:dxo ()
> > (command "cmdecho" 0)
> > (command "_.dxfout"
> > (getfiled "DXF File:" (getvar"dwgprefix") "dxf" 1)
> > "_Objects" (ssget)
> > "" ; completes selection
> > "" ; non-default number or other option if desired, with followup line(s)
> > if necessary
> > ); end command
> > (command "cmdecho" 1)
> > ) >
>
> Question, after i used the command i get this error message (the lisp works!!!)
>
> > Command: DXO
> > Select objects: 1 found
> > Select objects: ; error: bad argument value: AutoCAD command: #@0000000028c5d610 IF> >
>
> Is there a possibility to get ride of that message. I used 'cmdecho 0', but is still there.
>
> Daniel
Craig
Message 9 of 10
CraigP_
in reply to: Anonymous

I am now using this as it suits us for what we do. Needed to be R12.

{code}
(defun c:dxf ()
(command "_.dxfout"
(getfiled "DXF File:" (getvar"dwgprefix") "dxf" 1)
"_Objects" (ssget)
"" ; completes selection
"_Version" "R12"
"" ; non-default number or other option if desired, with followup line(s) if necessary
)
(princ "DXF Created")
(princ)
)
{code}

Craig
Craig
Message 10 of 10
Anonymous
in reply to: Anonymous

I know the WBLOCK command in AutoCAD 2007 and up provides a file type filter
to create an R12 DXF version.
But I don't know how or if this feature can be accessed via Lisp/VLisp.

Paul

wrote in message
news:6229825@discussion.autodesk.com...
I am now using this as it suits us for what we do. Needed to be R12.

{code}
(defun c:dxf ()
(command "_.dxfout"
(getfiled "DXF File:" (getvar"dwgprefix") "dxf" 1)
"_Objects" (ssget)
"" ; completes selection
"_Version" "R12"
"" ; non-default number or other option if desired, with followup line(s) if
necessary
)
(princ "DXF Created")
(princ)
)
{code}

Craig

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost