Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Autocad/OpenDWG automation
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Autocad/OpenDWG automation
Miscellaneous
Thread ID:
00847451
Message ID:
00847451
Views:
51
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
Reply
Map
View

Click here to load this message in the networking platform