Author Topic: Using Excel to control AutoCAD  (Read 18833 times)

0 Members and 1 Guest are viewing this topic.

GegH1

  • Guest
Using Excel to control AutoCAD
« on: April 14, 2013, 09:56:10 PM »
I have a client who has an excel file he uses to calculate quotes.
He has requested that the excel file be dynamically linked to CAD so that when the cells are updated so is the drawing.
For example, he will be building a box, the box has a width, length, height. He will fill this out on his excel form in front of the client which will give him the costings it will also draw the box in AutoCAD.
When the client thinks it is too much he will be able to adjust the size of the box from the excel sheet and the cost and drawing is updated dynamically.

The drawing will always be a box.

Firstly, is this possible? (someone once said to me 'Anything is possible, the question is whether you have the knowledge to do it'....i'm not that knowledgeable...yet). Secondly, How?

Here's the kicker, he will next ask if he can use LT to do it? initially i would say no, you can't use lsp, .net or database with LT.....but would it be possible with using a lsp enabler like Cadsta Max?

Any help and advice would be awesome, i have to first identify whether it is possible then how much it will cost him to develop.

MexicanCustard

  • Swamp Rat
  • Posts: 705
Re: Using Excel to control AutoCAD
« Reply #1 on: April 15, 2013, 08:36:40 AM »
Is it possible in vanilla AutoCAD and it's verticals? Certainly, I use the ClosedXML library to do this now.  It can also be done in COM if Microsoft Office is installed on the machine with AutoCAD.  I just prefer the non-COM method.

Can it be done in LT?  I cannot answer that since I've never worked with LT.
Revit 2019, AMEP 2019 64bit Win 10

TheMaster

  • Guest
Re: Using Excel to control AutoCAD
« Reply #2 on: April 15, 2013, 10:41:24 AM »
I have a client who has an excel file he uses to calculate quotes.
He has requested that the excel file be dynamically linked to CAD so that when the cells are updated so is the drawing.
For example, he will be building a box, the box has a width, length, height. He will fill this out on his excel form in front of the client which will give him the costings it will also draw the box in AutoCAD.
When the client thinks it is too much he will be able to adjust the size of the box from the excel sheet and the cost and drawing is updated dynamically.

The drawing will always be a box.

Firstly, is this possible? (someone once said to me 'Anything is possible, the question is whether you have the knowledge to do it'....i'm not that knowledgeable...yet). Secondly, How?

Here's the kicker, he will next ask if he can use LT to do it? initially i would say no, you can't use lsp, .net or database with LT.....but would it be possible with using a lsp enabler like Cadsta Max?

Any help and advice would be awesome, i have to first identify whether it is possible then how much it will cost him to develop.

It's possible with AutoCAD, but not with LT out of the box. It's also possible to do entirely with AutoCAD, without the need for excel, using constraints, and requires no programming.

However, doing that sort of thing without great expense requires a reasonable level of experience with AutoCAD and its APIs. If you don't have that, then you're probably going to have to charge a lot more than someone with the prerequisites needed to produce a solution in a reasonable amount of time, and at a reasonable cost.

GegH1

  • Guest
Re: Using Excel to control AutoCAD
« Reply #3 on: April 16, 2013, 05:47:57 AM »
Guys, thankyou for this.

Excel is the pre-requisite for the project as that is what is used for his costings, materials lists, worksheets and ordering.

I do know CAD pretty well and i've done a bit of work with vb.net recently and a fair bit with scripts in the bad old days.

Any ideas where i can go to get started?

fixo

  • Guest
Re: Using Excel to control AutoCAD
« Reply #4 on: April 16, 2013, 06:21:56 AM »

GegH1

  • Guest
Re: Using Excel to control AutoCAD
« Reply #5 on: April 16, 2013, 06:47:45 AM »
That's interesting Fixo, i imagine it wouldn't take a lot to adapt this to manipulate a dynamic block based on numbers in the excel sheet?
Do you think it could do this dynamically as you move from Cell to cell?

TheMaster

  • Guest
Re: Using Excel to control AutoCAD
« Reply #6 on: April 16, 2013, 08:06:06 AM »
Any ideas where i can go to get started?

I'm not sure what you mean.

If you have the prerequisites (e.g., being familiar with the AutoCAD COM API) then it is pretty straight forward, but the programming has to be done on the Excel side, not on the AutoCAD side.

GegH1

  • Guest
Re: Using Excel to control AutoCAD
« Reply #7 on: April 16, 2013, 05:53:22 PM »
I have a lot of experience with AutoCAD and only a little with developing API's for autocad.
Maybe i'm having a brain freeze but i don't see anything straight forward about it. Could you give me a clue?

TheMaster

  • Guest
Re: Using Excel to control AutoCAD
« Reply #8 on: April 16, 2013, 09:43:02 PM »
I have a lot of experience with AutoCAD and only a little with developing API's for autocad.
Maybe i'm having a brain freeze but i don't see anything straight forward about it. Could you give me a clue?

You have to drive the changes to the AutoCAD model from Excel, using whatever API (e.g., Excel VBA, etc) you prefer. The AutoCAD COM API can be accessed from Excel VBA or any ActiveX-enabled API.

When I said 'straight forward', I meant for someone that is reasonably-familiar with AutoCAD's APIs.

GegH1

  • Guest
Re: Using Excel to control AutoCAD
« Reply #9 on: April 16, 2013, 10:35:06 PM »
Now that i'm not familiar with, i've been learning VB.net with AutoCAD but i have not driven autocad from an external program like Excel.

Could you give me a starter for 10 or an example so i can have a go and identify whether the client has the budget or i have the patience to proceed with the project, or at least proceed with the clients project. It sounds like something i'd like to learn anyway.

Thankyou for your help and patience

TheMaster

  • Guest
Re: Using Excel to control AutoCAD
« Reply #10 on: April 17, 2013, 12:53:16 AM »
Now that i'm not familiar with, i've been learning VB.net with AutoCAD but i have not driven autocad from an external program like Excel.

Could you give me a starter for 10 or an example so i can have a go and identify whether the client has the budget or i have the patience to proceed with the project, or at least proceed with the clients project. It sounds like something i'd like to learn anyway.

Thankyou for your help and patience

Sorry, what you're asking for is not something I consider within the bounds of helping peers with problems. You're asking for a bit more, and what you're seeking to do requires at least a year or two of full-time experience.

I'm available for consulting services, but of course, there's a fee involved.

hugha

  • Newt
  • Posts: 103
Re: Using Excel to control AutoCAD
« Reply #11 on: April 17, 2013, 03:33:48 AM »
If you have some familiarity with AutoLISP You may find this useful:

http://www.jefferypsanders.com/autolisp_XL.html


dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Using Excel to control AutoCAD
« Reply #12 on: April 17, 2013, 02:26:12 PM »
Based on the responses, I'm not certain the OP would be restricted to automating AutoCAD from the outside via COM.  This could be done within AutoCAD, consuming the Excel content as data.  Thats generally easier and faster than the former.  The "do this in front of the client" routine where everything updates as the data is changed is a bit much as described; it would be easier to do the work in Excel, switch to an active session of AutoCAD and execute an update or refresh command which would read the new values in Excel and change the drawing accordingly.

Since code is the end product and not the starting point, I think the best place to start with is detailed evaluation of the various processes you need e.g. read Excel file, convert data to something useable (validate for bad info!), create or link to AutoCAD objects, modify AutoCAD objects, and so on.  At this point, you should have a rough idea of the time budget required for the work.  Those procedural notes can be expanded into rough code, which can then be tested to evaluate desired work processes, help determine where user input is required and in what form.  The rough code can then be detailed out to get the final product.

As different interactions with AutoCAD are needed (e.g. create a line, insert a block) they can be investigated using examples here, in the ObjectARX SDK, and elsewhere.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

TheMaster

  • Guest
Re: Using Excel to control AutoCAD
« Reply #13 on: April 17, 2013, 03:15:10 PM »
Based on the responses, I'm not certain the OP would be restricted to automating AutoCAD from the outside via COM.  This could be done within AutoCAD, consuming the Excel content as data.  Thats generally easier and faster than the former.  The "do this in front of the client" routine where everything updates as the data is changed is a bit much as described; it would be easier to do the work in Excel, switch to an active session of AutoCAD and execute an update or refresh command which would read the new values in Excel and change the drawing accordingly.

Since code is the end product and not the starting point, I think the best place to start with is detailed evaluation of the various processes you need e.g. read Excel file, convert data to something useable (validate for bad info!), create or link to AutoCAD objects, modify AutoCAD objects, and so on.  At this point, you should have a rough idea of the time budget required for the work.  Those procedural notes can be expanded into rough code, which can then be tested to evaluate desired work processes, help determine where user input is required and in what form.  The rough code can then be detailed out to get the final product.

As different interactions with AutoCAD are needed (e.g. create a line, insert a block) they can be investigated using examples here, in the ObjectARX SDK, and elsewhere.

I would probably read what the OP wrote again.  It would appear that the 'client' doesn't currently have AutoCAD, is probably only familiar with Excel, and therefore, would most-likely not savor having to learn AutoCAD in order to automate its use using Excel data as a driver.

The other thing you make sound a bit too easy for the OP, is that in order to estimate the cost of doing development work, one must be reasonably-familiar with development and have some experience doing it, knowing what's entailed, what options are available, and so forth.

It wouldn't be easy for someone that's just starting out with AutoCAD development, that hasn't really done much besides hack on samples they've gotten from here and there, and may not understand very well, to be able to tell how many hours of work will be required to do something, if they don't know where to start.

Where I come from, people that represent themselves as professional consultants that are competent and qualified to do certain work, have to sign consulting services agreements that require them to certify in writing that they are qualified and capable of doing the work. And if it turns out that they're not, and the client suffers injury as a result, a professional liability insurance policy would probably come in handy.  I suppose that's why some clients (mostly in the public sector),  require their consultants to carry them.




« Last Edit: April 17, 2013, 03:27:14 PM by TT »

hugha

  • Newt
  • Posts: 103
Re: Using Excel to control AutoCAD
« Reply #14 on: April 17, 2013, 09:28:27 PM »
OP mentioned his client wants an AutoCAD drawing of a box driven from Excel. Going right to basics, if there are only a few parameters then it is perfectly possible to create the drawing from a script (.scr) file written and started by Excel VBA to drive the parameterised portion of the drawing within a selected template (.dwt) using LT.  Some skill with Office VBA required. It's very painstaking work akin to using Excel macros rather than its VBA, there's no room for error and very little error detection or error recovery.

This elementary approach won't easily scale of course to any level of complexity within the generated drawing - there's a point where AutoLISP becomes irresistible and you must leave LT behind (unless the add-on enablers actually do provide the promised programming functionality) for  full-fat AutoCAD, BricsCAD, Graebert's ARES or other programmable workalike.  Much can be done within the *Lisp macro workspace using various extender libraries.

The full flexibility offered by exploiting VBA or .NET automation where good development tools can be brought to bear (as well demonstrated all over this board) comes at the considerable cost of time spent acquiring sufficient competency.  While it's tempting to use the full kit for everything (why not? - it's now simpler) in some smaller cases it's a sledgehammer.

I second the necessity of always having E&O insurance. Don't leave home without it.  Gaining it often exposes deficiencies in how well you are set up to consult.
 

« Last Edit: April 17, 2013, 09:35:41 PM by hugha »

GegH1

  • Guest
Re: Using Excel to control AutoCAD
« Reply #15 on: April 17, 2013, 11:41:37 PM »
Thankyou for your active discussion, it has been most helpful.

1. The Client does have AutoCAD LT at the moment but is more comfotable with Excel. I realise LT can't do lsp straight out of the box but there is a product called 'Cadsta max' which may work. If it doesn't...we're stuffed before we start.

2. This product does need to scale. The box represents a shed, the shed will have a pitched roof, and we will have to add a number of windows and doors into each side of the shed. So i think it would be a little too much for .scr.

3. I am a consultant of sorts and have a couple of mill in insurance. At the moment i want to advise on the feasibility of developing the product, whether i could do it or get a third party to do it and either way whether it is worth doing from an economic point of view.

4. I estimate i would have about 140 hours in the budget (my time) to develop such a product. Therefore, if there were some code i could, in the words of TT 'Hack', and adapt into a working model that the client and myself could develop over time, it may be feasible. Otherwise i'm getting the impression it may be a bridge too far and learning to code would have to be something i do in my 'Spare time', not that i have much of that.

I do very much appreciate the discussion though it will probably have saved me getting into something that would take a lot longer than expected to finish, unless i have read it wrong?

TheMaster

  • Guest
Re: Using Excel to control AutoCAD
« Reply #16 on: April 18, 2013, 06:17:24 AM »
Thankyou for your active discussion, it has been most helpful.

1. The Client does have AutoCAD LT at the moment but is more comfotable with Excel. I realise LT can't do lsp straight out of the box but there is a product called 'Cadsta max' which may work. If it doesn't...we're stuffed before we start.

2. This product does need to scale. The box represents a shed, the shed will have a pitched roof, and we will have to add a number of windows and doors into each side of the shed. So i think it would be a little too much for .scr.

3. I am a consultant of sorts and have a couple of mill in insurance. At the moment i want to advise on the feasibility of developing the product, whether i could do it or get a third party to do it and either way whether it is worth doing from an economic point of view.

4. I estimate i would have about 140 hours in the budget (my time) to develop such a product. Therefore, if there were some code i could, in the words of TT 'Hack', and adapt into a working model that the client and myself could develop over time, it may be feasible. Otherwise i'm getting the impression it may be a bridge too far and learning to code would have to be something i do in my 'Spare time', not that i have much of that.

I do very much appreciate the discussion though it will probably have saved me getting into something that would take a lot longer than expected to finish, unless i have read it wrong?

FWIF, I "hack" all the time, and the term wasn't being used in a derogatory way.

The difficulty in doing something like this with minimal experience is that while you may be able to hack a working model or prototype together, the problem usually manifests in the form of it not meeting all of the client's expectations that weren't identified before the fact.

If I'm not familiar with the APIs or other components involved in a solution, it's difficult-to-impossible for me to accurately estimate the time required to do something, including the learning curve, assuming it's acceptable for the client to have to bear that additional cost.

I know a few consultants that don't do the work themselves, and subcontract it out to others, and what they usually do, is get an estimate from them, and then double it.

GegH1

  • Guest
Re: Using Excel to control AutoCAD
« Reply #17 on: April 18, 2013, 06:38:54 AM »
I like the use of the word Hack it's an honest word

I've fallen into the 'Client Expectation' trap already, this is actually a continuation of a previous post
 
http://www.theswamp.org/index.php?topic=44344.0

The client kind of 'Adjusted' the brief when i went for a progress meeting which is why i'm going to be very carefull about what i promise and a little more black and white about his options.

hugha

  • Newt
  • Posts: 103
Re: Using Excel to control AutoCAD
« Reply #18 on: April 18, 2013, 10:28:34 AM »
Cadsta Max may be excellent at what it does but it does not offer any integration with the VBA that you have shown interest in using in that prior post. Nor does it offer any integration with .NET which is, IMHO, the future. Given the complexity, I think you should seek the client's response to aquiring either a full AutoCAD seat or a .NET programmable workalike. Reluctance to invest could be a warning.

140 hours from go to whoa is, again IMHO, very tight. TT's right about client's spec creep biting you hard in the absence of an extremely prescriptive *WRITTEN* specification and I suspect there's some expectation of a fixed price budget which can lead to endless callbacks to fix tiny, tiny detail and is not to be recommended if there's any hint of R&D involved.   If the client is unwilling to be billed on a time & material basis then I'd suggest your offering to quote for a preparatory investigation/report and gauge the reaction to the accompanying Terms & Conditions.











Micaletti

  • Guest
Re: Using Excel to control AutoCAD
« Reply #19 on: April 18, 2013, 12:31:06 PM »
I would start with dgorsman's approach. The client doesn't really need to know AutoCAD to open it up, select an excel file, and press OK.  This approach looks expensive and much more time consuming.

« Last Edit: April 18, 2013, 01:04:44 PM by Micaletti »

TheMaster

  • Guest
Re: Using Excel to control AutoCAD
« Reply #20 on: April 18, 2013, 06:15:17 PM »
I would start with dgorsman's approach. The client doesn't really need to know AutoCAD to open it up, select an excel file, and press OK.  This approach looks expensive and much more time consuming.

That approach isn't even an option. It only provides the means to read/write DWG files, it doesn't display them, and can't be used from Excel.
« Last Edit: April 18, 2013, 06:52:04 PM by TT »

GegH1

  • Guest
Re: Using Excel to control AutoCAD
« Reply #21 on: April 18, 2013, 06:30:09 PM »
Hugh,
Thankyou for the info regarding Cadsta, this kinda makes the decision process simple, 'Are you going to buy full CAD?', and i kinda figured the 140 hours was a bit tight especially without knowing the programming language inside out. Looks like the project may be a labour of love for me in my 'spare time'.

I'll throw this one out there. Take AutoCAD out of the equation, we have a form in Excel with the dimensions of the shed, number, dimensions and position of the doors and windows, is there another way of creating a dynamic illustration of the shed based on the figures on the excel form?

TheMaster

  • Guest
Re: Using Excel to control AutoCAD
« Reply #22 on: April 18, 2013, 07:14:56 PM »
Hugh,
Thankyou for the info regarding Cadsta, this kinda makes the decision process simple, 'Are you going to buy full CAD?', and i kinda figured the 140 hours was a bit tight especially without knowing the programming language inside out. Looks like the project may be a labour of love for me in my 'spare time'.

I'll throw this one out there. Take AutoCAD out of the equation, we have a form in Excel with the dimensions of the shed, number, dimensions and position of the doors and windows, is there another way of creating a dynamic illustration of the shed based on the figures on the excel form?


Sure is. 

For starters, WPF is a very capable 2D/3D graphics kernel (most think it's about UIs but it can be used to generate any kind of 2D and 3D vector graphics as well) see http://msdn.microsoft.com/en-us/library/ms747393.aspx).

You can also use any number of third-party components, from simple libraries that allow you display simple 2D vector graphics (http://en.wikipedia.org/wiki/Gtk_Sharp), to full-blown embedded 2D and 3D CAD and modeling functionality (http://www.devdept.com).


hugha

  • Newt
  • Posts: 103
Re: Using Excel to control AutoCAD
« Reply #23 on: April 18, 2013, 08:22:03 PM »
Much depends on what the client expects to see at the push of a button. 

If the field's wide open on what to work in Sketchup might offer some fun:
http://www.youtube.com/watch?v=7Kcs6Ruspro

Sketchup uses Ruby scripting for automation.
http://www.sketchup.com/intl/en/developer/

If I had the time, I'd be playing with this myself :)

But it's a crowded market. Make or buy is always a tough decision in the design world but you can get an idea of what's out there by searching "Shed design software" and it may be that you could find a suitable system to set up to work with your client's Excel - for a suitable fee..

Micaletti

  • Guest
Re: Using Excel to control AutoCAD
« Reply #24 on: April 18, 2013, 09:37:31 PM »

That approach isn't even an option. It only provides the means to read/write DWG files, it doesn't display them, and can't be used from Excel.

I know it doesn't display them however it most certainly is an option given the client "doesn't have autocad" and is "only familiar with excel". An invisible or visible stand alone app can use both APIs. At first glance devDepot looks like a better option in that situation if it can be used from excel alone, but I would avoid either if at all possible. It would be fairly straight forward to consume excel data from AutoCAD at the press of a ribbon button.

I do like the DWG idea better. It's always nice to have a DWG of a product, especially if you can automate it's production.
« Last Edit: April 19, 2013, 12:36:17 AM by Micaletti »

TheMaster

  • Guest
Re: Using Excel to control AutoCAD
« Reply #25 on: April 19, 2013, 06:15:33 AM »

That approach isn't even an option. It only provides the means to read/write DWG files, it doesn't display them, and can't be used from Excel.

I know it doesn't display them however it most certainly is an option given the client "doesn't have autocad" and is "only familiar with excel". An invisible or visible stand alone app can use both APIs. At first glance devDepot looks like a better option in that situation if it can be used from excel alone, but I would avoid either if at all possible. It would be fairly straight forward to consume excel data from AutoCAD at the press of a ribbon button.

I do like the DWG idea better. It's always nice to have a DWG of a product, especially if you can automate it's production.

It's pretty clear from the OPs description that he wants to see the graphical result as values are being changed in the Excel spreadsheet, as opposed to spitting out a .DWG file that he must then open and view.

For that reason, RealDWG is not an option, because it can't display the graphical output while the user is changing values in the spreadsheet (or any other UI), so I have to beg to differ.
« Last Edit: April 19, 2013, 10:42:14 AM by TT »

WILL HATCH

  • Bull Frog
  • Posts: 450
Re: Using Excel to control AutoCAD
« Reply #26 on: April 19, 2013, 10:53:27 AM »
Regarding Autocad OEM:
Quote
The licensing fee structure is fairly simple and straightforward making it easier for you to be flexible and competitive in your market. The fees consist of $5,000 for licensing the OEM (this is per upgrade) and 25% royalty fee calculated from your total OEM based revenue.

GegH1

  • Guest
Re: Using Excel to control AutoCAD
« Reply #27 on: April 24, 2013, 05:53:53 AM »
TT, have you had any eperience with (http://www.devdept.com).
I have this right don't i, this is building a stand alone .net CAD app custom made to produce whatever you want, as in one of the videos, a kitchen, in my case a shed. and the components could be developed in AutoCAD and imported into the application.

I'm assuming it is complicated to develop? beyond me anyway? or do the develop it for you?

Sorry for sounding like an idiot, i'm not quite sure what the product is, but i'm very interested in the possibilities

WILL HATCH

  • Bull Frog
  • Posts: 450
Re: Using Excel to control AutoCAD
« Reply #28 on: April 24, 2013, 12:27:44 PM »
I have this right don't i, this is building a stand alone .net CAD app custom made to produce whatever you want, as in one of the videos, a kitchen, in my case a shed. and the components could be developed in AutoCAD and imported into the application.
Looks like that will work for you.
Quote
I'm assuming it is complicated to develop? beyond me anyway? or do the develop it for you?
You'll be on  your own developing for their app, from a brief look at their forum there isn't a lot of support as it's a pretty new product.  Considering that you'd still need to spend 900 euros to get surface support it's not too cheap

TheMaster

  • Guest
Re: Using Excel to control AutoCAD
« Reply #29 on: April 24, 2013, 12:40:12 PM »
TT, have you had any eperience with (http://www.devdept.com).
I have this right don't i, this is building a stand alone .net CAD app custom made to produce whatever you want, as in one of the videos, a kitchen, in my case a shed. and the components could be developed in AutoCAD and imported into the application.

I'm assuming it is complicated to develop? beyond me anyway? or do the develop it for you?

Sorry for sounding like an idiot, i'm not quite sure what the product is, but i'm very interested in the possibilities

In general, because it is a component, it generally is more difficult to use for building what amounts to a very-customized CADD application. So, many of the things that AutoCAD's API makes easy for you, may not be there in the same form, and would most-likely require more work.

In your case, it might be overkill since you're not really trying to enable a full interactive CADD system, you're just trying to automate creation of a drawing from user-supplied data that doesn't require them to do any kind of drawing.

Gasty

  • Newt
  • Posts: 90
Re: Using Excel to control AutoCAD
« Reply #30 on: April 24, 2013, 02:46:12 PM »
Hi,

May I'm missing something, but another alternative could be create a DXF file "by hand", starting with a "smart" DXF template (predefined blocks, styles, layers,etc) , it's not  that complicate to do so, and it doesn't requires any other software, only AutoCAD for the template creation and testing. However this solution goes from very complicated to impossible if you need solids or surfaces to represent the final result.

Gaston Nunez




WILL HATCH

  • Bull Frog
  • Posts: 450
Re: Using Excel to control AutoCAD
« Reply #31 on: April 24, 2013, 06:39:47 PM »
As far as I understood the OP wants to see changes in real time

GegH1

  • Guest
Re: Using Excel to control AutoCAD
« Reply #32 on: April 24, 2013, 07:12:06 PM »
That's right, he would like changes in real time.
It also sounds like the DevDept product would meet all his criteria except cost and time, which is quite a large part of the criteria. It is sounding a little like the cost and time criteria are a little unrealistic for any of the options.
The option to draw in excel is probablt the most realistic but i'm not sure the result will be 'fine' enough.
I have a meeting with the client tomorrow to discuss options and will come back here to let you know what happens.

WILL HATCH

  • Bull Frog
  • Posts: 450
Re: Using Excel to control AutoCAD
« Reply #33 on: April 25, 2013, 12:13:55 PM »
The question in my mind now, is why not just combine a few of the suggestions here... Using WPF to draw the real time visual isn't too hard, creating a DXF file which could be imported into AutoCAD isn't too hard either.  Since you're only drawing a simple shed you will only need to worry about simple faces, unless there is a greater level of detail required in the DWG we aren't aware of.

GegH1

  • Guest
Re: Using Excel to control AutoCAD
« Reply #34 on: April 25, 2013, 04:51:28 PM »
4 walls, pitched roof, doors and windows.

Size and number of openings as well as size of shed and pitch of roof are variable.

TheMaster

  • Guest
Re: Using Excel to control AutoCAD
« Reply #35 on: April 25, 2013, 08:15:15 PM »
That's right, he would like changes in real time.
It also sounds like the DevDept product would meet all his criteria except cost and time, which is quite a large part of the criteria. It is sounding a little like the cost and time criteria are a little unrealistic for any of the options.
The option to draw in excel is probablt the most realistic but i'm not sure the result will be 'fine' enough.
I have a meeting with the client tomorrow to discuss options and will come back here to let you know what happens.

Here is something I found interesting, built with WPF graphics and Silverlight:

   http://numeracyworks.com/Site/Home.html

Using this free library:

  http://livegeometry.codeplex.com/

WILL HATCH

  • Bull Frog
  • Posts: 450
Re: Using Excel to control AutoCAD
« Reply #36 on: April 25, 2013, 08:33:40 PM »
Thanks Tony, very interesting

GegH1

  • Guest
Re: Using Excel to control AutoCAD
« Reply #37 on: April 25, 2013, 10:21:24 PM »
The websites keep crashing on me, ie9, win 7 64bit.

AKS

  • Guest
Re: Using Excel to control AutoCAD
« Reply #38 on: May 12, 2013, 11:40:05 PM »
Have your Excel code write out text files describing the shed. Have a Processing (www.processing.org) application you write use those files to constantly regenerate the shed image. One of the text files could contain information about how the image is to be viewed if you did not want to add view controls to the Processing application. If the shed parts are always the same, for example it always has something that would be the roof, then there could be simple controls at the Processing side to perform visibility operations on the parts.

fixo

  • Guest
Re: Using Excel to control AutoCAD
« Reply #39 on: May 13, 2013, 05:10:31 PM »
That's interesting Fixo, i imagine it wouldn't take a lot to adapt this to manipulate a dynamic block based on numbers in the excel sheet?
Do you think it could do this dynamically as you move from Cell to cell?
Sorry for the belating, here is code snip from my test form
You can only select mating cells in a column and / or row this way
Code: [Select]
       //
        //                     * clean up *
        //
        private static void releaseObject(object obj)
        {
            try
            {
                System.Runtime.InteropServices.Marshal.ReleaseComObject(obj);
                obj = null;
            }
            catch (System.Exception ex)
            {
                obj = null;
                MessageBox.Show("An error occurred while releasing memory of the object" + ex.ToString());
            }
            finally
            {
                if (obj != null)
                {
                    int pos = GC.GetGeneration(obj);
                    GC.Collect(pos);
                }
                else { GC.Collect(); }
                GC.WaitForPendingFinalizers();
            }
        }

       
        //using Excel = Microsoft.Office.Interop.Excel;
       // defined on Form scope
        //string strFileName = "C:\\Test\\Cars.xls";
        //Excel.Application xlApp = default(Excel.Application);
        private void btnRef_Click(object sender, EventArgs e)
        {
            string rangeAddress = "";
            StringBuilder sb = new StringBuilder();
            xlApp = new Excel.ApplicationClass();
            Excel.Workbook xlWorkBook = default(Excel.Workbook);
            Excel.Worksheet xlWorkSheet = default(Excel.Worksheet);
            Excel.Range xlRange = default(Excel.Range);
            xlApp.Visible = true;
            object misValue = System.Reflection.Missing.Value;
            xlWorkBook = xlApp.Workbooks.Open(strFileName, misValue, misValue, misValue
                                              , misValue, misValue, misValue, misValue
                                             , misValue, misValue, misValue, misValue
                                            , misValue, misValue, misValue);
           
            xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
           
            xlWorkSheet = (Excel.Worksheet)xlApp.ActiveSheet;
           xlApp.ScreenUpdating = true;
            xlApp.DisplayAlerts = false;
            xlApp.Interactive = false;
    Excel.Range range = null;
    try
    {
        range = (Excel.Range)xlApp.Application.InputBox("Select cell range", Type.Missing, Type.Missing, Type.Missing,
                                Type.Missing, Type.Missing, Type.Missing, 8) as Excel.Range;

        xlApp.DisplayAlerts = true;
        if (range != null)
            rangeAddress = ((Excel.Range)range).AddressLocal;
        object data = ((Excel.Range)range).Value;
        object[,] varArray = (object[,])data;
        ((Excel._Workbook)xlWorkBook).Close(false);
        xlApp.Quit();
        foreach (object item in varArray)
            sb.AppendLine(item.ToString());
       
                     
    }
    catch
    {
        xlApp.Quit();
        releaseObject(xlRange);
        releaseObject(xlWorkSheet);
        releaseObject(xlWorkBook);
        releaseObject(xlApp);
    }
    finally
    {

        if (xlApp != null) System.Runtime.InteropServices.Marshal.FinalReleaseComObject(xlApp);
        xlApp = null;
        MessageBox.Show(sb.ToString());
       
    }
    }
You can change this to your suit