1

I'm trying add a point in currently opened Autocad drawning. As reference I'm using VBA example from AddPoint manual:

VBA:

RetVal = object.AddPoint(Point)

object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

Point

Access: Input-only

Type: Variant (three-element array of doubles)

The coordinates of the point to be created.

Sub Example_AddPoint()
    ' This example creates a point in model space.
    Dim pointObj As AcadPoint
    Dim location(0 To 2) As Double

    ' Define the location of the point
    location(0) = 5#: location(1) = 5#: location(2) = 0#

    ' Create the point
    Set pointObj = ThisDrawing.ModelSpace.AddPoint(location)
    ZoomAll

End Sub

So far I'm successfully connected to ActiveX object and can get/set many things with it (as long as it requires a string input), except I can't figure out how create a

Variant (three-element array of doubles)

required for AddPoint function

Here is autoit code I'm playing with:

Local $location[3] = [5.0,5.0,0.0]
Local $oAcad = ObjGet("","AutoCAD.Application")
$oAcad.ActiveDocument.Modelspace.AddPoint($location)

It returns error:

"1.au3" (3) : ==> The requested action with this object has failed.:
$oAcad.ActiveDocument.Modelspace.AddPoint($location)
$oAcad.ActiveDocument.Modelspace^ ERROR

There is no details about error even with error handler, so I assume datatype of $location variable is wrong.

vanowm
  • 9,466
  • 2
  • 21
  • 37
  • I'm not sure if that will work but try creating `DllStruct()` as `"double;double;double"` and then either passing it or its `DllStructGetPtr` pointer to COM. Other than that - try asking on AutoIt forums. – Jack White Dec 09 '18 at 19:33

0 Answers0