Reply

How to use: BalloonObject.GetTerminator() method in C++

[ Edited ]

 

Hi all,

I need an example of using GetTerminator() Method with a balloon object in C++.

-> Object.GetTerminator(TerminatorObj, x, y, z, KeyPoint)

how should I define the TerminatorObj in C++ (IDispatch**)

Thank you

 Code:

CString CBallooningTestDlg::GetRefNameOfBalloon(BalloonPtr& pRefBalloon)

{

 

    ???     ptr;

    double            x, y, z;

    VARIANT_BOOL    bKeyPoint;

 

 

    HRESULT hr = pRefBalloon->GetTerminator(ptr, &x, &y, &z, &bKeyPoint);

 

    if (SUCCEEDED(hr))

    {

        ...

    }

    ...

}

 

Posted by: Abou Mimin
Post date: 12/16/2007 6:58:16 AM

3 REPLIES

RE: How to use: BalloonObject.GetTerminator() method in C++

[ Edited ]

 

Here is an example

 int _tmain(int argc, _TCHAR* argv[]){ SolidEdgeFramework::ApplicationPtr pApplication = NULL; SolidEdgeDraft:Smiley Very HappyraftDocumentPtr pDraft = NULL; SolidEdgeDraft:Smiley FrustratedheetsPtr pSheets = NULL; SolidEdgeDraft:Smiley FrustratedheetPtr pSheet = NULL; SolidEdgeFrameworkSupport::BalloonsPtr pBalloons = NULL; SolidEdgeFrameworkSupport::BalloonPtr pBalloon = NULL; IDispatchPtr pTerminator = NULL; SolidEdgeFramework::ReferencePtr pReference = NULL; double x = 0; double y = 0; double z = 0; VARIANT_BOOL keyPoint = VARIANT_FALSE; ITypeInfoPtr pTypeInfo = NULL; BSTR bstrName; CoInitialize(NULL); pApplication.GetActiveObject(_T("SolidEdge.Application")); pDraft = pApplication->ActiveDocument; pSheets = pDraft->Sheets; pSheet = pSheets->Item((LONG)1); pBalloons = pSheet->Balloons; pBalloon = pBalloons->Item((LONG)1); /* Call GetTerminator passing an IDispatchPtr in the 1st parameter */ pBalloon->GetTerminator(&pTerminator, &x, & y, &z, &keyPoint); /* Get a pointer to the ITypeInfo of the underlying IDispatchPtr*/ pTerminator->GetTypeInfo(0, 0, &pTypeInfo); /* Get the Type Lib documentation for the COM Type */ pTypeInfo->GetDocumentation(-1, &bstrName, NULL, NULL, NULL); /* In my example draft, bstrName was of type 'Reference */ /* So the following line will work */ pReference = pTerminator; pTypeInfo = NULL; pReference = NULL; pTerminator = NULL; pBalloon = NULL; pBalloons = NULL; pSheet = NULL; pSheets = NULL; pDraft = NULL; pApplication = NULL; CoUninitialize(); return 0;}

 

Posted by: Jason Newell
Post date: 12/16/2007 8:54:51 PM

RE: How to use: BalloonObject.GetTerminator() method in C++

[ Edited ]

 

Thank you for your reply!

How can I get the filename of the balloon node  and the parent filename of this node in the CAD structure.

Thanks a lot

 

Posted by: Abou Mimin
Post date: 12/17/2007 12:40:07 AM

RE: How to use: BalloonObject.GetTerminator() method in C++

[ Edited ]

 

Hi Jason,

 

here is an example, in which the balloons assignment is ambiguous.The main assembly consists of two subassemblies ASM1.asm> and ASM2.asm>. Each subassembly contains two parts. Both subassemblies share the part Part1.par>.

 

My PDM Parts List:

 

ASM1.asm……………..10

         Part1.par……...10

         Part2.par…...…20

ASM2.asm…………..…20

         Part3.par………10

         Part1.par………20

 

Solid Edge Parts List:

 

PosNr      Qty        Filename

1             2             part1.par

2             1             part2.par

3             1             part3.par

 

 

has a different item number within the PDM parts list. However it has the same item number within solid edge parts list (Quantity = 2). I have created two drawing views of both subassemblies ASM1 and ASM2 and used the solid edge auto ballooning. The problem is that I am not able to fill the Part1.par> balloon with the correct PDM item number (two positions are possible 10 or 20).

This is due to the fact the balloon object provides any information about the subassembly, in which Part1.par> is used.

 

In order to achieve a correct mapping between PDM parts list and Solid Edge parts list, I would like to get following information about each balloon on a drawing view via Solid Edge API (C++):

 

Balloon Object

 

-         Filename

Find the filename of the part that the balloon is pointing to. (For example Part1.par)

 

-         Immediate assembly

Find the filename of the immediate parent (Subassembly) (For example ASM1.asm or ASM2.asm)

 

When I create a drawing view which shows views of an assembly, I would like to get the filename of this assembly using the drawing view object, is there a possibility to achieve this via Solid Edge API?

 

 Thank you for your support.

 

Posted by: Abou Mimin
Post date: 2/4/2009 7:06:23 AM