Reply

SolidEdge - Delphi

[ Edited ]

 

Hello,

its my first try to program solidedge in delphi.I want to draw a profile, and extrude it.

I can draw the profile, but on the AddfiniteExtrudedProtrusion command break down, and says typeMitchmatch.

I think the problem is with the AProfile declaration.

Can Someone help me? Are somebody programming solidedge in delphi?

Thanks !

The source code is the following:

unit belso_huvely;

interface

uses

  Windows, Messages, Variants, Classes, Graphics, Controls, Forms, SysUtils, Math,

  Dialogs, StdCtrls, ComObj, SolidEdgeConstants_TLB, SolidEdgePart_TLB,

  ExtCtrls;

type

  TForm1 = class(TForm)

    Label1: TLabel;

    Label2: TLabel;

    Label3: TLabel;

    Label4: TLabel;

    Label5: TLabel;

    L: TEdit;

    ID: TEdit;

    OD: TEdit;

    Alfa: TEdit;

    H: TEdit;

    Button4: TButton;

    Image1: TImage;

    Button1: TButton;

    Edit1: TEdit;

    procedure Button1Click(Sender: TObject);

    procedure Koordinatak;

  private

    { Private declarations }

  public

    { Public declarations }

  end;

var

  Form1: TForm1;

  SolidSmiley SurprisedleVariant;

  ValtozotablaSmiley SurprisedleVariant;

  DokumentumSmiley SurprisedleVariant;

  PartSmiley SurprisedleVariant;

  ProfilesetsSmiley SurprisedleVariant;

  ProfilesetSmiley SurprisedleVariant;

  ProfilesSmiley SurprisedleVariant;

  RefplanesSmiley Surprisedlevariant;

  ProfileSmiley Surprisedlevariant;

  Lines2dSmiley Surprisedlevariant;

  Relations2dSmiley Surprisedlevariant;

  Relation2dSmiley Surprisedlevariant;

  ModelsSmiley Surprisedlevariant;

  ModelSmiley Surprisedlevariant;

  AProfileSmiley Surprisedlevariant;

  X: array[1..5] of Real;

  Y: array[1..5] of Real;

 

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);

var

  i: integer;

begin

  Koordinatak;

  try

    Solid := GetActiveOleObject('SolidEdge.Application');

  except

    on EOleSysError do Solid := CreateOleObject('SolidEdge.Application');

  end;

  Solid.Visible := True;

  Dokumentum := Solid.Documents;

  Part := Dokumentum.Add('SolidEdge.PartDocument');

  Profilesets := Part.ProfileSets;

  Profileset := Profilesets.Add;

  Profiles := Profileset.Profiles;

  Refplanes := Part.RefPlanes;

  Profile := Profiles.Add(refplanes.Item(3));

  Lines2d := Profile.Lines2d;

  For I := 1 to 4 do

  begin

    Lines2d.AddBy2Points(X,Y,X[i+1],Y[i+1]);

  end;

  Lines2d.AddBy2Points(X[5],Y[5],X[1],Y[1]);

 

  Relations2d := Profile.Relations2d;

  For I := 1 to 4 do

  begin

    Relation2d := Relations2d.AddKeypoint(Lines2d.Item(I),igLineEnd,Lines2d.Item(I+1),igLineStart);

  end;

  Relation2d := Relations2d.AddKeypoint(Lines2d.Item(5),igLineEnd,Lines2d.Item(1),igLineStart);

  Profile.End(igProfileClosed);

  Profile.Visible := True;

  AProfile := VarArrayCreate([1,1],varVariant);

  AProfile[1] := Profile;

  Models := Part.Models;

  Model := Models.AddFiniteExtrudedProtrusion(1,AProfile,igRight,0.05,0,0,0,0);

end;

 

Posted by: Ungi Laszlo
Post date: 3/4/2009 5:54:42 AM

2 REPLIES

RE: SolidEdge - Delphi

[ Edited ]

 

HI,

just an advice.

Programming SolidEdge can be frustrating, if you dont have examples of how to do things

and where to start.

It should be easier to develop in VB net or C# , since there are many examples already available

to use as template.

Only to translate an example from VB or C# to Delphy will take time and effort.

Till now, I never heard about developing in Delphy with SolidEdge.

Anyway, sure you can do it also in Delphy.

Regards

Massimo

 

Posted by: Massimo Magris
Post date: 3/4/2009 7:57:23 AM

Re: SolidEdge - Delphi

Hi,

Have you got a solution? I am using RAD2010 and having the same problem. I just read another post with someone using VBScript and the same problem comes up. It has to be at Solid Edge's doorstep.

I am committed to writing methods in Delphi, so maybe we can help each other, if you are still using Delphi.