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

Data Extraction not tied to drawing file

5 REPLIES 5
Reply
Message 1 of 6
drafting87
1193 Views, 5 Replies

Data Extraction not tied to drawing file

Hi All,

I am trying to create a lisp program that will automatically extract wire numbers from a drawing (the wire numbers are attributes) and export them to an csv file with the click of a button. The csv file is then opened with a custom program that will print labels so that they wires can be labeled on-site. This seemed like it should be a relatively simple program. I created and saved a dxe file to extract all the appropriate information, set up the lisp to run -dataextraction and everything works just fine. The problem occurs when I try to run the program in a new drawing file, since the dxe file appears to be locked to the drawing that it was created in I keep getting the same data set regardless of what drawing I currently have open. Is there anyway to separate the dxe template file from the drawing it was created in?

I've recently been trying to use ATTEXT, and while that will pull the data from the current drawing I haven't found a way for it to count the blocks the way I need it too.

Any suggestions would be greatly appreciated, I've been researching this on and off for about a month.

Thanks!
5 REPLIES 5
Message 2 of 6
Anonymous
in reply to: drafting87

Dataextraction?

wrote in message news:6391501@discussion.autodesk.com...
Hi All,

I am trying to create a lisp program that will automatically extract wire
numbers from a drawing (the wire numbers are attributes) and export them to
an csv file with the click of a button. The csv file is then opened with a
custom program that will print labels so that they wires can be labeled
on-site. This seemed like it should be a relatively simple program. I
created and saved a dxe file to extract all the appropriate information, set
up the lisp to run -dataextraction and everything works just fine. The
problem occurs when I try to run the program in a new drawing file, since
the dxe file appears to be locked to the drawing that it was created in I
keep getting the same data set regardless of what drawing I currently have
open. Is there anyway to separate the dxe template file from the drawing
it was created in?

I've recently been trying to use ATTEXT, and while that will pull the data
from the current drawing I haven't found a way for it to count the blocks
the way I need it too.

Any suggestions would be greatly appreciated, I've been researching this on
and off for about a month.

Thanks!
Message 3 of 6
drafting87
in reply to: drafting87

My original plan was to use the DATAEXTRACTION command, which opens the data extraction wizard. The problem is that a new and separate .dxe must be created for each drawing (or group of drawings) that you want to extract data from. This seriously gets in the way of creating a lisp routine which will work universally.

Thanks!
Message 4 of 6
Anonymous
in reply to: drafting87

The name of the original drawing is hard-coded in the .dxe file, as
inspection with a hex editor will reveal. (Let's ignore multiple files,
okay?)

Using -dataextraction prompts only for the name of the .dxe file, not
the name of the source file, so that doesn't help.

Best thing I can suggest is to *copy* a drawing to
c:\temp\wirenumbers.dwg and create the c:\temp\wirenumbers.dxe file.
Then, after you have edited and saved each file you want to run the
extraction on, your Lisp would just have to

{code}
(setvar 'filedia 0)
(command "._saveas" "2010" "c:\\temp\\wirenumbers.dwg" "yes") ;; the yes
is to replace the .dwg file
(command "._-dataextraction" "c:\temp\wirenumbers.dxe" "yes") ;; the yes
is to replace the .csv file
(setvar 'filedia 1)
(command "._close")
{code}

and you should be good to go.

I haven't actually tried this, of course. There might be prompts like
"File exists. Overwrite - yes or no?" that you'll need to accommodate,
but if there is always a wirenumbers.dwg and a wirenumbers.dxe in the
temp directory, you can standardize the response. Maybe check to see if
they exist and act accordingly.

-Bill

On 5/18/2010 8:51 AM, drafting87 wrote:
> My original plan was to use the DATAEXTRACTION command, which opens the data extraction wizard. The problem is that a new and separate .dxe must be created for each drawing (or group of drawings) that you want to extract data from. This seriously gets in the way of creating a lisp routine which will work universally.
>
> Thanks!
>
Message 5 of 6
drafting87
in reply to: drafting87

Thanks bunches Bill!

It worked like a charm. 🙂

The idea of a "dummy" drawing that gets overwritten every time had never even occurred to me.

Just in case anyone else happens to be having the same issue, I did need to add in the "Y" to overwrite the existing drawing otherwise it only works once. 🙂
Message 6 of 6
Anonymous
in reply to: drafting87


On 5/19/2010 1:37 PM, drafting87 wrote:

Thanks bunches Bill!

It worked like a charm. :)

The idea of a "dummy" drawing that gets overwritten every time had never even occurred to me.

Just in case anyone else happens to be having the same issue, I did need to add in the "Y" to overwrite the existing drawing otherwise it only works once. :)




Glad to hear it worked.



This method does limit you to one drawing at a time, but it you had to
process many at once, the routine could be tweaked to rename each new
.csv file with the filename of the current .dwg. That way, you could
batch process an entire folder, and end up with dwgA.csv, dwgB.csv,
etc., to be processed later as needed.



Of course, I haven't actually tried that, either!



-Bill

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

Post to forums  

Autodesk Design & Make Report

”Boost