• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

autocad programming from external application

  • Thread starter Thread starter Giorgio Devoti
  • Start date Start date

Giorgio Devoti

Guest
Good day to all,
I have an autocad programming problem from an external application.
I can practically open autocad and a design, but I can't access other objects.
the code is as follows:

dim acadapp as new acadapplication
dim acaddoc as acaddocument
dim levels as acadlayers

set acadapp = createobject("autocad.application")
acadapp.visible = true
acadapp.documents.open filename, true
set acaddoc = acadapp.documents(1)
acaddoc.activate
'// at this point autocad is open and the design is loaded
set levels = acadapp.activedocument.layers
'// at this point the error is highlighted:
run-time error'-2145386390(8020006a)':
no matching database found

I press that:
the vb project has a reference to the library:
autocad 2008 type library
the project is compiled without errors
I already did a successful search based on the error code

Can someone help me?
 
io ho fatto una prova da excel con vba e così mi funziona correttamente

private sub commandbutton1_click()
dim acadapp as new acadapplication
dim acaddoc as acaddocument
dim livelli as acadlayers

where error resume next
nomefile = "c:\m22.dwg"

set acadapp = createobject("autocad.application")
acadapp.visible = true
acadapp.documents.open nomefile, true

seven acaddoc = acadapp.documents(1)
acaddoc.activate
set livelli = acadapp.activedocument.layers
dim testlayer as acadlayer
seven testlayer = livelli.add("test")

end sub
 
thanks shape,
after some unsuccessful attempts, I tried to "repair" the installation of autocad and everything went fine. Obviously something had been corrupted that, while not sewing compilation errors, did not make the activex work.
Thank you all.
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top