Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AutoCAD Input/Output to a database

Status
Not open for further replies.

jeffduck

Programmer
Jul 24, 2005
17
US
Hi folks,

I'm a newbie here and not currently an AutoCAD user.

I'm trying to develop a database that outputs to AutoCAD. Everything in the database will be 3D rectangles. I would like to have something like an ODBC or XML interface, but even some sort of cut-and-paste would be beneficial.

If possible, I would like to be able to also export from AutoCAD to the database.

Can anyone provide some guidance as to how I can get started with this or even if it can be done?

Thanks much!

--------------------------------
Jeff Duck
FileMaker 7 Certified Developer
 
Hi Jeff,

I've covered some of the basics of talking back and forth to AutoCAD via Access using ADO here. I realize this isn't quite what you're doing, but it should give you a good primer on how to get started. Since you are not an AutoCAD user, I'm sure you'll need more than this, so by all means post back with more specifics if you need to.

HTH
Todd
 
Thanks Todd. This gives me some insight.

Any idea of how long it may take me to learn AutoCAD to where I can do this? (I have high school level hand drafting skills and can read basic prints.)

Also, any idea of how to get data into AutoCAD from an external database?

Thanks much! I appreciate the fast reply

--------------------------------
Jeff Duck
FileMaker 7 Certified Developer
 
Hi Jeff,

As to how long it will take you, only you can answer that question, but if you know how to write code, particularly VBA code - it probably won't take you that long.

As for getting the values into AutoCAD, just read the record set from your database, and plug them in to your function, maybe something like this:

Code:
  Dim rs As New adodb.recordset
  Dim objCube As AcadSolid
  Dim InsPnt(0 To 2) As Double
  Dim dblLength As Double
  Dim dblWidth As Double
  Dim dblHeight As Double
    
  '... <<recordset stuff here>> ...
  
  While Not rs.EOF
    ' Collect the pertinent variables:
    '
    With rs
      InsPnt(0) = .Fields("X").Value
      InsPnt(1) = .Fields("Y").Value
      InsPnt(2) = .Fields("Z").Value
      
      dblLength = .Fields("Length").Value
      dblWidth = .Fields("Width").Value
      dblHeight = .Fields("Height").Value
    End With
    
    ' Draw 3D rectangle:
    '
    Set objCube = ThisDrawing.ModelSpace.AddBox(InsPnt, dblLength, dblWidth, dblHeight)
    
    ' Move to the next record:
    '
    rs.Movenext
  Wend
  ...


HTH
Todd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top