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:rofileSetsPtr spProfileSets = spDocument->GetProfileSets();
SolidEdgePartSync:rofileSetPtr spProfileSet = spProfileSets->Add();
The Add method throws the exception.
Any help will be greately welcome.
Posted by: Vadim Zlotnikov
Post date: 12/8/2009 1:05:47 AM
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:rofilePtr CreateProfileForSketch( SolidEdgePartSync:artDocumentPtr pPartSyncDoc, double Origin, double Normal, double Xaxis, SolidEdgePartSync:ketchPtr& pPartSyncSketch )
if( NULL == pPartSyncSketch )
if( NULL != pPartSyncDoc )
pPartSyncSketches = pPartSyncDoc->Sketches;
if( NULL != pPartSyncSketches )
pPartSyncSketch = pPartSyncSketches->AddByPlaneGeometry( Origin, Origin, Origin, Normal, Normal, Normal, Xaxis, Xaxis, Xaxis);
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;
Posted by: R.D. Holland
Post date: 1/26/2010 4:54:53 AM
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:rojectEdge 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.
Posted by: Vadim Zlotnikov
Post date: 2/1/2010 2:02:53 AM