Open CASCADE, the 3D modelling kernel
3D modeling & numerical simulation

Search the Forums
See All Topics
 

Diffitulties with basics: GC_MakeSegment

Diffitulties with basics: GC_MakeSegment
Gilles Paiva 2012/05/30 23:16
I am studying OpenCascade and had some difficulties with GC_MakeSegment class.

I send the error and the program below. Any ideas about what´s happening???

The error:
/tmp/ccIDqMyc.o: In function `main':
hello.cpp:(.text+0x197): undefined reference to `GC_MakeSegment::GC_MakeSegment(gp_Pnt const&, gp_Pnt const&)'
/tmp/ccIDqMyc.o: In function `Handle_Standard_Transient::~Handle_Standard_Transient()':
hello.cpp:(.text._ZN25Handle_Standard_TransientD2Ev[_ZN25Handle_Standard_TransientD5Ev]+0xd): undefined reference to `Handle_Standard_Transient::EndScope()'
collect2: ld returned 1 exit status


The program:
#include <iostream>
#include <gp_Pnt.hxx>
#include <Geom_CartesianPoint.hxx>
#include <Geom_Line.hxx>
#include <Geom_Circle.hxx>
#include <GC_MakeSegment.hxx>
#include <GC_MakeArcOfCircle.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <GC_MakeArcOfCircle.hxx>
#include <GC_MakeSegment.hxx>

using namespace std;

int main()

{

cout << "First studies" << endl;

int myHeight = 70;
int myWidth = 50;
int myThickness = 30;

// my points
gp_Pnt aPnt1(-myWidth / 2. , 0 , 0);
gp_Pnt aPnt2(-myWidth / 2. , -myThickness / 4. , 0);
gp_Pnt aPnt3(0 , -myThickness / 2. , 0);
gp_Pnt aPnt4(myWidth / 2. , -myThickness / 4. , 0);
gp_Pnt aPnt5(myWidth / 2. , 0 , 0);

// The error happens here!
GC_MakeSegment mkSeg (aPnt1 , aPnt2);

return 0;
}
You have to be logged in to download the attached file
Denis Barbier 2012/05/30 23:45
Hello, add flags "-lTKGeomBase -lTKernel" (without quotes) when linking.
Gilles Paiva 2012/05/31 15:30
It worked fine! Thank you!

Is there any tutorial showing how to create .IGES files?

I need to save my geometry using this file format.
Alexander Schneller 2012/06/01 13:56
Hi Gilles,

have a look on the iges.pdf (3.3.4. Writing the IGES file, page 31)
or on the ImportExport sample.
Or look at the Drawmethod "static Standard_Integer brepiges (Draw_Interpretor& di, Standard_Integer n, const char** a)"
at the file \ros\src\XSDRAWIGES\XSDRAWIGES.cxx

Regards
Alex
Gilles Paiva 2012/06/01 17:24
Hi, Alex.

I still trying to understand how to create IGES files. When I used the following command: "IGESControl_Writer Writer;" to create my writer, got this error:

command to compile: g++ -I/usr/include/opencascade/ -o helloMod hello.cpp -lTKGeomBase -lTKernel

Error:
/tmp/ccTIbohm.o: In function `main':
hello.cpp:(.text+0x1a9): undefined reference to `IGESControl_Writer::IGESControl_Writer()'
collect2: ld returned 1 exit status


I send my file (with the main routine) attached, but there´s the program below:
#include <iostream>
#include <gp_Pnt.hxx>
#include <Geom_CartesianPoint.hxx>
#include <Geom_Line.hxx>
#include <Geom_Circle.hxx>
#include <GC_MakeSegment.hxx>
#include <GC_MakeArcOfCircle.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <GC_MakeArcOfCircle.hxx>
#include <GC_MakeSegment.hxx>
#include <IGESControl_Writer.hxx>
#include <IGESControl_Controller.hxx>

using namespace std;

int main()
{

cout << "Tutorial OpenCascade - My first application" << endl;

// Some initial data
int myHeight = 70;
int myWidth = 50;
int myThickness = 30;


// My points
gp_Pnt aPnt1(-myWidth / 2. , 0 , 0);
gp_Pnt aPnt2(-myWidth / 2. , -myThickness / 4. , 0);
gp_Pnt aPnt3(0 , -myThickness / 2. , 0);
gp_Pnt aPnt4(myWidth / 2. , -myThickness / 4. , 0);
gp_Pnt aPnt5(myWidth / 2. , 0 , 0);

// Object to be written
GC_MakeSegment mkSeg (aPnt1 , aPnt2);

// My writer
IGESControl_Writer Writer; // Error happens here

return 0;

}
You have to be logged in to download the attached file
Gilles Paiva 2012/06/01 17:36
Hi, Alex. I solved my problems (at least, for a while).
I added the following to the compile command: "-lTKIGES"     

the complete command is the following: "g++ -I/usr/include/opencascade/ -o helloMod hello.cpp -lTKGeomBase -lTKernel -lTKIGES"

Thank you (and everybody) for the help!
 
 
Latest news
  • OCCT Applications
  • Open CASCADE Technology 6.8.0 is available for download!
  • New features to enhance the development process

  • © OPEN CASCADE 2000 - 2014  |  Search  |  Contacts   |  Site map