Reply

Add method of SolidEdgePartSync::ProfileSets throws an exception

[ Edited ]

 

Hello All,

I've started moving our application to Solid Edge ST2 and encounter with the following problem:

One of the things we need to do is to project an arc on a 2d profile. We have a code taken from the programming guide, which worked in Solid Edge ST (100) and the previous versions. However, in the ST2 the code throws the "Unspecified error" exception.

The code is in VC++ 2008:

SolidEdgePartSync:Smiley TongueartDocumentPtr spDocument;

... Initialization...

SolidEdgePartSync:Smiley TonguerofileSetsPtr spProfileSets = spDocument->GetProfileSets();

SolidEdgePartSync:Smiley TonguerofileSetPtr spProfileSet = spProfileSets->Add();

The Add method throws the exception.

 

Any help will be greately welcome.

Thanks,

Vadim

 

Posted by: Vadim Zlotnikov
Post date: 12/8/2009 1:05:47 AM

2 REPLIES

RE: Add method of SolidEdgePartSync::ProfileSets throws an exception

[ Edited ]

Get the Sketchs collection from the sync part doc and call the Add method. Here is some sample code where I create a specific sketch (with a given orientation).

 

SolidEdgePartSync:Smiley TonguerofilePtr CreateProfileForSketch( SolidEdgePartSync:Smiley TongueartDocumentPtr pPartSyncDoc, double Origin[3], double Normal[3], double Xaxis[3], SolidEdgePartSync:Smiley FrustratedketchPtr& pPartSyncSketch )

{

SolidEdgePartSync:Smiley TonguerofilePtr pPartSyncProfile;

if( NULL == pPartSyncSketch )

{

SolidEdgePartSync:Smiley FrustratedketchsPtr pPartSyncSketches;

 

if( NULL != pPartSyncDoc )

{

pPartSyncSketches = pPartSyncDoc->Sketches;

}

 

if( NULL != pPartSyncSketches )

{

pPartSyncSketch = pPartSyncSketches->AddByPlaneGeometry( Origin[0], Origin[1], Origin[2], Normal[0], Normal[1], Normal[2], Xaxis[0], Xaxis[1], Xaxis[2]);

}

}

 

if( NULL != pPartSyncSketch )

{

pPartSyncSketch->PutEnableRegions ( VARIANT_TRUE );

// orignially called PutMergeWithCoplanarSketches here. But that is not

// good logic as the system is creating "permanent" sketches when AddByPlaneGeometry is called so I

// get a different sketch when using the same plane in the AddByPlaneGeometry call. Then when

// PutMergeWithCoplanarSketches is called, the sketches merge. So the logic error is that the sketch

// is empty at this point. I need to set the flag after Profile->End is called. But I decided

// to just always create multiple sketches.

 

//pPartSyncSketch->PutMergeWithCoplanarSketches ( VARIANT_TRUE );

pPartSyncSketch->PutMigrateGeometryAndDimensions ( VARIANT_TRUE );

 

pPartSyncProfile = pPartSyncSketch->Profile;

}

 

return pPartSyncProfile;

}

 

 

Posted by: R.D. Holland
Post date: 1/26/2010 4:54:53 AM

RE: Add method of SolidEdgePartSync::ProfileSets throws an exception

[ Edited ]

R.D. Holland,

Thank you very much for your response.

 

I tried to implement your suggestion but encountered some problem:

 

My scenario is to get information about arcs/circle geometry by projecting them on 2d. All the examples in the Programmer's Guide show, that I need to add a profile set, then get a profile. Prior to ST2 I used the Profile:Smiley TonguerojectEdge method and then converted the result to Arc2d or Circle2d. When I have implemented the Sketch-Profile solution, I was unable to get Arc2d or Circle2d objects neither from the ProjectEdge method result nor from the Arcs2d / Circles2d Profile properties.

 

Any ideas?

 

Vadim

 

Posted by: Vadim Zlotnikov
Post date: 2/1/2010 2:02:53 AM