Error -No Database in 2005 Hot !!!!

Discussion in 'AutoCAD' started by Postonz, Nov 18, 2004.

  1. Postonz

    Postonz Guest

    in VBA code as follows in ACAD 2005
    Windows XP Pro
    on this line >>> Set wedgeObj = ActiveDocument.ModelSpace.AddWedge(centerx, lengthx, widthx, heightx)
    It works in AutoCAD 2000 in Windows XP Pro
    -----------------------
    Dim wedgeObj As Acad3DSolid
    Dim AcadObjs As Object
    Dim AcadDoc As Object
    Dim acadObj As Object
    Dim centerx(0 To 2) As Double
    Dim lengthx As Double
    Dim widthx As Double
    Dim heightx As Double


    Private Sub CommandButton1_Click()
    Set AcadObjs = GetObject(, "AutoCAD.Application") 'USED IN OLD R2000 CODE
    Set AcadDoc = AcadObjs.ActiveDocument
    centerx(0) = 0#: centerx(1) = 0#: centerx(2) = 0
    lengthx = 10#: widthx = 10#: heightx = 20#
    Debug.Print "centers = "; centerx(0); " "; centerx(1); " "; centerx(2)
    Debug.Print "length = "; lengthx; " "; "width = "; widthx; " "; "height ="; heightx

    ' Create the wedge in model space
    Set wedgeObj = ActiveDocument.ModelSpace.AddWedge(centerx, lengthx, widthx, heightx)
    wedgeObj.Update
     
    Postonz, Nov 18, 2004
    #1
  2. Maybe it's because it should read:

    Set wedgeObj = AcadDoc.ModelSpace.AddWedge(centerx, lengthx, widthx,
    heightx)

    But then again, it wouldn't work in 2000 either.
    So if it's not syntax then it should be that your AcadDoc is empty
     
    Jorge Jimenez, Nov 19, 2004
    #2
  3. Postonz

    postonz Guest

    Hi Jorge...
    My son came over (autocad wizard) an said that my AutoCad .dll was BAD...
    I had installed INVENTOR 9 Trail addition...
    I deleted off Inventor... autocad... others... R-Loaded AutoCad... WORKS PERFECTL...
    I wish to thank everyone for their assistances in my problems... THANKS...
     
    postonz, Nov 19, 2004
    #3
  4. Postonz

    Jackrabbit Guest

    If you're working in AutoCAD VBA, you don't need to connect to AutoCAD (i.e. you don't need the GetObject stuff).

    This code works for me in AutoCAD 2005:
    [pre]
    Public Sub DrawWedge()

    Dim Center(0 To 2) As Double
    Dim Height As Double
    Dim Length As Double
    Dim Wedge As Acad3DSolid
    Dim Width As Double

    Center(0) = 0#
    Center(1) = 0#
    Center(2) = 0#

    Length = 10#
    Width = 10#
    Height = 20#

    Set Wedge = ThisDrawing.ModelSpace.AddWedge(Center, Length, Width, Height)
    ThisDrawing.Application.ZoomExtents

    End Sub
    [/pre]
     
    Jackrabbit, Nov 19, 2004
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.