Information générale
Catégorie:
COM/DCOM et OLE Automation
Titre:
Autocad/OpenDWG automation
I am having trouble getting an array of Doubles passed correctly to the OpenDWG ActiveX control. Here is the code in VFP8 to add a line of text to an AutoCAD DWG:
*************
dimension insertionPoint(3) as Double
* Define the text object
textString = "Hello, World."
insertionPoint(1) = 6300.000 && x coord
insertionPoint(2) = 7800.000 && y coord
insertionPoint(3) = 0.000 && z coord
height = 60.0
=COMARRAY(odaHost,10) && set array passing to zero-based by reference
= COMARRAY(odaApp,10) && set array passing to zero-based by reference
=COMARRAY(odaDoc,10) && set array passing to zero-based by reference
=COMARRAY(odaDoc.ModelSpace,10) && set array passing to zero-based by reference
* Create the text object in model space
textObj = odaDoc.ModelSpace.AddText(textString, @insertionPoint, height)
*************
Now the above code works without throwing any errors, and the text appears in the DWG (in the wrong place) because AutoCAD always has the x,y,z values shifted so that the result is 0.000,6300.000,7800.000 instead of 6300.000,7800.000,0.000
It appears that COMARRAY is having no effect and still passing a "1" based array to the ActiveX control. Getting desperate, I COMARRAYed every object up the tree, but no luck. I see on the newsgroups others have not fared well with the exact same issue of automating Autocad from VFP.
Any ideas?
Thanks.
-- Paul
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement