Jump to content
cmangi86

Import Excel to DWGPROPS

Recommended Posts

cmangi86

I work as an engineer for a solar company. We preform all of our calculations on an excel file, then transfer these values to Autocad to show our calculations for the plan checkers. I use the DWGPROPS command in Autocad to auto populate all the pages in my plans. I tend to do a lot of copy and pasting and to do all this.

 

Is there a way to isolate the excel values I need and import them into my Autocad DWGPROPS?

Share this post


Link to post
Share on other sites
ReMark

You can bring in an entire worksheet or a range of cells via the Table > Datalink command.

Share this post


Link to post
Share on other sites
cmangi86

Thanks for the reply, but it isn't quite what I am looking for. I need the table to insert directly into the DWGPROPS command, not just in a separate table. Do you know if that is possible?

Share this post


Link to post
Share on other sites
ReMark

I have no idea. Inserting the table in the drawing makes more sense to me. But it is your drawing so place your data anywhere you want.

Share this post


Link to post
Share on other sites
BlackBox

The short answer is... No.

 

A more complete answer... Is that despite the inability to paste an Excel cell range directly into specific components of DWGPROPS, one can write a relatively simple LISP routine, which can programmatically query the applicable cell values, and populate the Document Object's (read Drawing's) SummaryInfo Object's Properties accordingly. :beer:

 

HTH

Share this post


Link to post
Share on other sites
cmangi86

Hmm that is interesting... I have never written a LISP routine before. So I guess that will be my next question. What is and how do I write one?

Share this post


Link to post
Share on other sites
BlackBox

Hmm that is interesting... I have never written a LISP routine before. So I guess that will be my next question. What is and how do I write one?

 

That is a loaded question... You'll have to forgive the simplicity implied by my previous post, as I do quite a bit of programming these days.

 

LISP is a programming language exposed to AutoCAD in the form of an API, which allows for users to access Objects to query Property values, Settings, etc.. at the Entity, Document (read Drawing), and Application level. My description in no way does justice to fully quantify an answer here, but I am short on time at the moment.

 

Written quickly... Here's a small example of being able to access, in this case 'view', the SummaryInfo Object's Properties and Methods from the Command Line:

 

(vl-load-com)

(defun c:DumpSummaryInfo ()
 (textpage)
 (vlax-dump-object
   (vla-get-summaryinfo
     (vla-get-activedocument (vlax-get-acad-object))
   )
   T
 )
 (princ)
)

 

You can simply copy this code, paste it at the Command Line, and hit Enter to load the code into your ActiveDocument (read the current drawing)... To invoke, simply enter "DumpSummaryInfo" (no quotes) at the Command Line, and again hit Enter. The rest is self-explanitory (once you invoke).

 

HTH

Share this post


Link to post
Share on other sites
BlackBox

Before I forget... If/When you or someone willing to help you, code this up... Be sure to start thinking about the Excel data you're needing to query. Specifically, does this data need to remain in .XLS(x) format, or can it be exported to .CSV, etc. as there is significant;y less overhead (within LISP) to access that sort of data file, and process, etc..

 

Accessing Excel.Application directly requires not only more overhead, but also error handling... A bit more than the typical LISP beginner is accustom.

Share this post


Link to post
Share on other sites
BIGAL

If your game I think it was over at "theswamp" there is a really good excel lsp to down load I have it at home not at work I think it was "Getexcel.lsp" it has a number of functions, getacell, getmultiple cells and opposites put values into excel. It is well laid out with lots of comments about how it works. I will have a look at home later I think I found it Googling.

Share this post


Link to post
Share on other sites
BlackBox

I could be wrong, but that sounds like a Jefferey P. Sanders (sp?) routine... Further, if its the one I have in mind, it imports the typed library functions with prefixes, in lieu of interfacing with the Excel.Application Object.

 

Perhaps our good friend Oleg can join into this conversation and offer some of his great code samples? :beer:

Share this post


Link to post
Share on other sites
BIGAL

Renderman you have me there it makes a "list" of the cells it suited the task I was looking for will paste link when I get home. Looking forward To Oleg contribution.

Share this post


Link to post
Share on other sites
irneb

Yep the Swamp thread: http://www.theswamp.org/index.php?topic=38450.0

 

And the GetExcel.LSP seems to be made by Terry Miller. Some other nifty routines from the same: http://web2.airmail.net/terrycad/AutoLISP-Code.htm

 

And for the DwgProps side of things you might want to look at an old one of mine: http://forums.augi.com/showthread.php?84208-Autocomplete-or-linking-text-within-a-drawing&p=870861&viewfull=1#post870861

Share this post


Link to post
Share on other sites
BlackBox

Thanks for the correction/clarification, Irne :beer:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×