Delphi - GetEntity

Discussion in 'AutoCAD' started by Jack Houben, Jun 18, 2004.

  1. Jack Houben

    Jack Houben Guest

    Hello all,

    I'm having difficulties selecting a 3DSolid in autocad using delphi 5

    VBA source works fine:
    Dim returnobj As AcadObject
    Dim basePnt As Variant
    Public backbone As Acad3DSolid

    .....
    ThisDrawing.Utility.GetEntity returnObj, basePnt, "Select backbone."
    Set backbone = returnobj
    .....

    However in Delphi:
    Util: AcadUtility;
    ac_Obj: AcadObject;
    PickedPoint: OleVariant;
    .....
    Util:= AcadApp.ActiveDocument.Utility;
    .....
    Util.GetEntity(ac_Obj,PickedPoint,'Select the Backbone'); <-- line with
    error
    .....

    I get the (compiler) error:
    Types of actual and formal var parameters must be identical

    The cursor blinks just after the first comma

    Thanks!
     
    Jack Houben, Jun 18, 2004
    #1
  2. Jack Houben

    Jackrabbit Guest

    [pre]
    Util: AcadUtility;
    ReturnedObj: IDispatch;
    ac_Obj: AcadEntity
    PickedPoint: OleVariant;
    ....
    Util:= AcadApp.ActiveDocument.Utility;
    ....
    Util.GetEntity(ReturnedObj,PickedPoint,'S elect the Backbone');
    ac_Obj := ReturnedObj as AcadEntity;
    ....
    [/pre]
     
    Jackrabbit, Jun 18, 2004
    #2
  3. Jack Houben

    Jack Houben Guest

    Thanks Jackrabbit!

    Works just fine.

    Another issue...
    Is this the way to get a 3DSolid from a BlockReference?
    Especialy the IDispatch part!

    Count: integer;
    ac_ExplObjects: OleVariant;

    ...
    ac_ExplObjects:=ac_BlockRef.Explode;
    for count:=VarArrayLowBound(ac_ExplObjects,1) to
    VarArrayHighBound(ac_ExplObjects,1) do
    begin
    if ac_ExplObjects[count].Layer='WELD_CLEARANCE_150' then
    ac_3DS_Clearance150 := IDispatch(ac_ExplObjects[tel]) as
    IAcad3DSolid
    else
    begin
    ...
    ac_ExplObjects[count].Delete;
    ...
    End;
    End;
    ac_3DS_Clearance150 := IDispatch(ac_ExplObjects[tel]) as IAcad3DSolid

    Greetz,
    Jack
     
    Jack Houben, Jun 21, 2004
    #3
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.