PDA

View Full Version : Inserting symbols to coordinates from excel


mcae1
04-08-2005, 08:35 PM
Hello,

I need to insert symbols to certain 2d coordinates at a certain angle into autocad from a table in excel

excel table example:

x l y l angle of symbol
315678.12 l 414563.27 l 150
325566.45 l 256566.67 l 13
346554.78 l 445455.32 l 278

Is there any way of writing a VBA or a macro to do this (or any other way)? I have done some VB progamming before but not that confident

please help

Eddie
06-08-2005, 12:04 PM
8) What you want is certainly achievable in VB/A...do you have any code down yet if so can you post it ?

mcae1
07-08-2005, 09:45 PM
cheers eddie

i dont have any code because i dont know really where to start.

is there any chance someone could write a code to help me out....what i'm doing at the mo is really tedious....have gots hundreds of these to do

Cheers

Eddie
08-08-2005, 03:23 AM
8) I'll see what I can do...

carsonm
06-02-2006, 02:47 PM
I've never imported information from Excel into AutoCAD - I foresee a few problems with that - I personally use text files (a csv would be better)

The following function should insert that dwg file to the points supplied. Sorry for the lack of comments - just pulled it from my snippet library... anyway


Function InsertObjectAtPoint(stObjectName As String, _
doX As Double, _
doY As Double, _
doZ As Double, _
doAngle As Double) As Boolean

Dim obBlockRef As AutoCAD.AcadBlockReference
Dim arInsertionPoint(0 To 2) As Double

arInsertionPoint(0) = doX
arInsertionPoint(1) = doY
arInsertionPoint(2) = doZ

Set obBlockRef = ThisDrawing.ModelSpace.InsertBlock(arInsertionPoin t, stObjectName, 1#, 1#, 1#, doAngle)
With obBlockRef
'Set properties of block
.Layer = "0" 'Layer of block
.color = acWhite 'Colour of block
End With

Set obBlockRef = Nothing
InsertObjectAtPoint = True
End Function


Reply if you're still confused... with a description of exactly what you are attempting to do.