Excel to AutoCAD Data Links

Excel to AutoCAD Data Links

bhankeyDNXY7
Contributor Contributor
1,623 Views
12 Replies
Message 1 of 13

Excel to AutoCAD Data Links

bhankeyDNXY7
Contributor
Contributor

I have a Village Map with residents addresses on it in AutoCAD. I have an excel spreadsheet with the addresses and weather there services lines are lead or cooper. I have linked the excel table into the AutoCAD document, but can I somehow tell AutoCAD based on the residents addresses, weather to hatch there yard a certain color if there service is lead and another color if there service is cooper?

0 Likes
1,624 Views
12 Replies
Replies (12)
Message 2 of 13

devitg
Advisor
Advisor

@bhankeyDNXY7 Please, if possible, upload both dwg and  xls files 

 

0 Likes
Message 3 of 13

Sea-Haven
Mentor
Mentor

Like Devitg need a sample but you have not explained how the address lives in the Autocad is it text a block a x,y. If you have any of those then you have a match and hatch the lot. 

 

code

ssget ( layer & text)

repeat ss and match text in master list

look at insertion point do hatch
0 Likes
Message 4 of 13

bhankeyDNXY7
Contributor
Contributor

The text is a block.

How do I upload the files onto this platform? This is the first time I am using this chat.

0 Likes
Message 5 of 13

bhankeyDNXY7
Contributor
Contributor

Attached is the dwg with the excel table linked. Please let me know if this helps with finding a solution

0 Likes
Message 6 of 13

bhankeyDNXY7
Contributor
Contributor

Please see the attached dwg with the excel table linked. Please let me know if this helps with finding a solution.

0 Likes
Message 7 of 13

roland.r71
Collaborator
Collaborator

The problem here is that you can't read (or write) to an excel file (even if bound) using lisp (auto- or visual-)

It is possible Using a ODBC link though... there is a function written by Jeffery P. Sanders using VBA (vla- & vlax- ) just for that: Getcells

 

I've used it a few times, when no other options are available. (I prefer to use .csv files when ever possible)

 

You can retrieve the collumn containing the adresses, as a list.

You can then use that list for matching with the drawn map.

 

...but his website is currently down I just now noticed, so I can't link you to it.

(should still have a copy around somewhere)

 

0 Likes
Message 8 of 13

cadffm
Consultant
Consultant

@bhankeyDNXY7 

You can read the information directly from the table or from the excel file, both are possible,

but are you able to do the rest of the Job?

- Find the Adress / Blockreference in the drawing

- find the Polyline

- Hatch the objects

 

?

 

If not, you are searching for a programmer or a ready program, not for help to develop your own program by yourself!?

 

Sebastian

0 Likes
Message 9 of 13

roland.r71
Collaborator
Collaborator

@cadffm wrote:

<snip>

but are you able to do the rest of the Job?

<snip>

If not, you are searching for a programmer or a ready program, not for help to develop your own program by yourself!?

 


Hmmm, I think  the question"can I somehow tell AutoCAD" somewhat gives the answer to that...

0 Likes
Message 10 of 13

bhankeyDNXY7
Contributor
Contributor

I am unclear on what you mean by searching for a programmer or a ready program.

0 Likes
Message 11 of 13

roland.r71
Collaborator
Collaborator

Considering your post carefully and thoroughly the short answer is: No there's no way to tell AutoCAD to do that, as it has no build in function(s) to do all you request. but it's not impossible. So...

 

The long answer is: Yes, you can. By writing a program which will interact with AutoCAD and Excel, to do it.

There are a few ways & languages to do so, most common around this part of the forum would be LISP, which runs inside autocad itself, but it might as well be an Autocad Runtime eXtention, or something else completely.

 

It all depends on what you want, can do yourself, or can pay. As this is a job for someone for some time to accomplish.

Message 12 of 13

bhankeyDNXY7
Contributor
Contributor

Ok, thank you for all the responses.

0 Likes
Message 13 of 13

Sea-Haven
Mentor
Mentor

Just to confuse you, its possible to go the other way and drive it from Excel using a macro. As excel has VBA and again like Autocad you can open communication with Autocad. You want to be proficient in VBA to go this way.

 

Sub Opendwg()
 
    Dim acadApp As Object
    Dim acadDoc As Object

 'Check if AutoCAD application is open. If is not opened create a new instance and make it visible.
    On Error Resume Next
    Set acadApp = GetObject(, "AutoCAD.Application")
    If acadApp Is Nothing Then
        Set acadApp = CreateObject("AutoCAD.Application")
        acadApp.Visible = True
    End If

 

0 Likes