Sunday, February 05, 2012
Add method of SolidEdgePartSync::ProfileSets throws an exception
Last Post 01 Feb 2010 08:02 AM by Vadim. 2 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
VadimUser is Offline
New Member
New Member
Posts:4

--
08 Dec 2009 07:05 AM  

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::PartDocumentPtr spDocument;

... Initialization...

SolidEdgePartSync::ProfileSetsPtr spProfileSets = spDocument->GetProfileSets();
SolidEdgePartSync::ProfileSetPtr spProfileSet = spProfileSets->Add();

The Add method throws the exception.

 

Any help will be greately welcome.

Thanks,

Vadim

R.D. HollandUser is Offline
Solid Edge Developer
New Member
New Member
Posts:50

--
26 Jan 2010 10:54 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::ProfilePtr CreateProfileForSketch( SolidEdgePartSync::PartDocumentPtr pPartSyncDoc, double Origin[3], double Normal[3], double Xaxis[3], SolidEdgePartSync::SketchPtr& pPartSyncSketch )
{
SolidEdgePartSync::ProfilePtr pPartSyncProfile;
if( NULL == pPartSyncSketch )
{
SolidEdgePartSync::SketchsPtr 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;
}
VadimUser is Offline
New Member
New Member
Posts:4

--
01 Feb 2010 08:02 AM  
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::ProjectEdge 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
You are not authorized to post a reply.

Active Forums 4.2
Copyright © 2011 JasonNewell.NET