CADTutor: The best free help for AutoCAD on the web

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
Go Back   AutoCAD Forums > AutoCAD > AutoLISP, VBA, the CUI & Customisation

Reply
 
Thread Tools
Old 4th Nov 2009, 02:29 pm   #1
kindy52
Full Member
 
Using: AutoCAD 2009
 
Join Date: Aug 2009
Posts: 44
Default Data extraction lisp file needed -2009

I'm looking for code that runs data extraction to predetermined selections without all of the prompting windows.

The procedure would be as follows:
1. prompt user for selection of objects
2. run data extraction for just the lines getting the info of count, name, layer, length
3. save as an xls file only (no table in drawing) named "takeoff" in the current folder of course

I'm new to lisp and am experimenting with the action recorder. What I am trying to get past in all applications are pauses in macros or lisp files due to prompting windows in the commands when I already know what these selections are to be.

Any insight or advice would be greatly appreciated.
kindy52 is offline   Reply With Quote
Old 5th Nov 2009, 04:32 am   #2
SteveK
Senior Member
 
Using: AutoCAD 2010
 
Join Date: Mar 2009
Location: Brisbane, Australia
Posts: 250
Default

If you are learning lisp the action recorder won't by much help.
Why don't you post your attempts and we can help you...

SteveK is offline   Reply With Quote
Old 5th Nov 2009, 05:38 am   #3
alanjt
Super Member
 
alanjt's Avatar
 
Using: Civil 3D 2009
 
Join Date: Apr 2008
Posts: 1,488
Default

So, you are wanting to create a selection set (ssget I assume), then iterate through the selection, sorting by layer and exporting to an .xls document the layer name, quantity, length, etc. Is this correct?

The vlax-curve functions can give you a lot of your total lengths information. Quantity is easy, you just separate out objects by layer and get a length. As Steve said, post your attempts and we can make something work.

Seann: ...it went crazy ex-girlfriend on me...
eric_monceaux...
its pretty funny seeing two AutoCAD Gods give each other flak...
alanjt is offline   Reply With Quote
Old 5th Nov 2009, 06:16 am   #4
SteveK
Senior Member
 
Using: AutoCAD 2010
 
Join Date: Mar 2009
Location: Brisbane, Australia
Posts: 250
Default

And quickly before Alan gets bored and writes it all.

SteveK is offline   Reply With Quote
Old 5th Nov 2009, 06:19 am   #5
alanjt
Super Member
 
alanjt's Avatar
 
Using: Civil 3D 2009
 
Join Date: Apr 2008
Posts: 1,488
Default

Quote:
Originally Posted by SteveK View Post
And quickly before Alan gets bored and writes it all.
LoL
I'm keeping busy hanging out with my little girl. My wife has a huge class load this semester, so she's glued to grading and preparing lectures.

I like to help out when I can; it's really good exercise.

Seann: ...it went crazy ex-girlfriend on me...
eric_monceaux...
its pretty funny seeing two AutoCAD Gods give each other flak...
alanjt is offline   Reply With Quote
Old 5th Nov 2009, 06:30 am   #6
SteveK
Senior Member
 
Using: AutoCAD 2010
 
Join Date: Mar 2009
Location: Brisbane, Australia
Posts: 250
Default

Quote:
Originally Posted by alanjt View Post
LoL
I'm keeping busy hanging out with my little girl. My wife has a huge class load this semester, so she's glued to grading and preparing lectures.

I like to help out when I can; it's really good exercise.
I'm glad you do. Always plenty to learn.

SteveK is offline   Reply With Quote
Old 5th Nov 2009, 06:40 am   #7
alanjt
Super Member
 
alanjt's Avatar
 
Using: Civil 3D 2009
 
Join Date: Apr 2008
Posts: 1,488
Default

Quote:
Originally Posted by SteveK View Post
I'm glad you do. Always plenty to learn.
That's the truth. I wish I could just get paid to program all day.

Seann: ...it went crazy ex-girlfriend on me...
eric_monceaux...
its pretty funny seeing two AutoCAD Gods give each other flak...
alanjt is offline   Reply With Quote
Old 5th Nov 2009, 11:02 am   #8
kindy52
Full Member
 
Using: AutoCAD 2009
 
Join Date: Aug 2009
Posts: 44
Default

What I am doing is making a 2d roof plan (above view) of lines all in one layer (0). Then I assign new layers to all of the lines using names such as "eave", "ridge", "hip", etc. This I have covered.

After assigning all the new layer names, I run the dx command: data extraction. Which is an 8 page window of prompts:
1-Q: Choice of to use a previous dxe template or start a new one
A: Start a new one save as "takeoff" in default file location
2-Q: Drawings Sheet source
A: Select Objects
3-Q: Objects
A: Line (only)
4-Qroperties
A: Layer & Length Only
5-Q: Refine Data
A: No change, next,
6-Q:Choose Output
A: Output to external File "takeoff.xls" in file location
7-(skipped because "table insertion" in 6 wasn't chosen")
8- Finish

What I want to accomplish (with the same result) is running a command (lets call it "takeoff") and it only prompt the following:
2-"Select Objects"
User select objects, enter.
6-"save as:"
User saves xls file in proper location.
and your done without all of the other promptings.

This is for coworkers who are not normal cad users. I think I may have taken on something I can't accomplish as easily as I thought.

"What if there is no tomorrow? There wasn't one today!"
kindy52 is offline   Reply With Quote
Old 5th Nov 2009, 11:00 pm   #9
SteveK
Senior Member
 
Using: AutoCAD 2010
 
Join Date: Mar 2009
Location: Brisbane, Australia
Posts: 250
Default

Whoa I didn't even know of that command.

Anyways, are you trying to learn lisp or are you just wanting someone to write it? I only ask because it's probably be a good program to learn from.
You'd start with an ssget function which selects objects. If you are just wanting lines it'd be:
Code:
(setq ss (ssget '((0 . "LINE"))))
Then it's just two more steps: extracting the data (easy) and exporting it (which is the difficult bit).

SteveK is offline   Reply With Quote
Old 6th Nov 2009, 01:14 am   #10
kindy52
Full Member
 
Using: AutoCAD 2009
 
Join Date: Aug 2009
Posts: 44
Default

Thank you for your interest.

I guess my answer is both. If someone would like to write it, that would be great. I am learning lisp on my own now and I am just getting to the command stage. I don't have a lot of time or I'd have learned it by now.

I know that you set ss to a variable. Is ssget of all the lines selected?

Do you know if lisp could run the dx command for you with only 2 of the prompts as I stated before? Would this possibly be a VBA problem?

You know the funny thing is I discovered dx when I miss typed dc trying to open up design center or I would never have known about it either!

P.S. I have no idea how that emocon ended up in my post on #4! lol

"What if there is no tomorrow? There wasn't one today!"
kindy52 is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Attribute Data Extraction Writing to External Excel File spur AutoCAD General 0 1st Nov 2009 08:02 pm
Data Extraction RyanAtNelco AutoCAD Drawing Management & Output 4 31st May 2009 08:16 am
Attribute data extraction/lisp/other... Caddy79 AutoCAD Drawing Management & Output 2 28th Apr 2009 09:30 pm
HELP.... Autocad 2009 Data Extraction JBullseye74 AutoCAD Drawing Management & Output 8 23rd Feb 2009 07:40 pm
Spline data extraction using lisp beproj AutoCAD General 3 27th Mar 2006 04:48 am

Why Donate?


All times are GMT +1. The time now is 03:37 am.

RSS Feed for AutoCAD ForumsValid XHTML 1.0!Valid CSS!Creative Commons Licence