Ok.. The original OCC download contained MakeBottle.cxx. I copied
and rename the file an wanted to see if I can get one line to compile
at a time. I also added a main() callout to give it some values
Anyway here it is:
#include <BRep_Tool.hxx>
#include <BRepAlgoAPI_Fuse.hxx> #include <BRepBuilderAPI_MakeEdge.hxx> #include <BRepFilletAPI_MakeFillet.hxx> #include <BRepLib.hxx> #include <BRepOffsetAPI_MakeThickSolid.hxx> #include <BRepPrimAPI_MakeCylinder.hxx> #include <GC_MakeArcOfCircle.hxx> #include <GCE2d_MakeSegment.hxx> #include <gp.hxx> #include <Geom_CylindricalSurface.hxx> #include <Geom2d_Ellipse.hxx> #include <TopExp_Explorer.hxx> #include <TopoDS.hxx> TopoDS_Shape //Profile : Define the Geometry //Profile : Define the Topology //Complete Profile aTrsf.SetMirror(xAxis); BRepBuilderAPI_Transform aBRepTrsf(aWire , aTrsf); BRepBuilderAPI_MakeWire mkWire; mkWire.Add(aWire); TopoDS_Wire myWireProfile = mkWire.Wire(); //Body : Prism the Profile TopoDS_Shape myBody = BRepPrimAPI_MakePrism(myFaceProfile , aPrismVec); //Body : Apply Fillets while(aEdgeExplorer.More()){ TopoDS_Edge aEdge = TopoDS::Edge(aEdgeExplorer.Current()); //Add edge to fillet algorithm aEdgeExplorer.Next(); myBody = mkFillet.Shape(); //Body : Add the Neck Standard_Real myNeckRadius = myThickness / 4.; BRepPrimAPI_MakeCylinder MKCylinder(neckAx2 , myNeckRadius , myNeckHeight); myBody = BRepAlgoAPI_Fuse(myBody , myNeck); //Body : Create a Hollowed Solid for(TopExp_Explorer aFaceExplorer(myBody , TopAbs_FACE) ; aFaceExplorer.More() ; aFaceExplorer.Next()){ TopoDS_Face aFace = TopoDS::Face(aFaceExplorer.Current()); //Check if <aFace> is the top face of the bottle’s neck if(aSurface->DynamicType() == STANDARD_TYPE(Geom_Plane)){ Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast(aSurface); gp_Pnt aPnt = aPlane->Location(); if(aZ > zMax){ zMax = aZ; TopTools_ListOfShape facesToRemove; facesToRemove.Append(faceToRemove); myBody = BRepOffsetAPI_MakeThickSolid(myBody , facesToRemove , -myThickness / 50 , 1.e-3); //return myBody; //Threading : Define 2D Curves Standard_Real aMajor = 2. * PI; Handle(Geom2d_Ellipse) anEllipse1 = new Geom2d_Ellipse(aAx2d , aMajor , aMinor); Handle(Geom2d_TrimmedCurve) aArc1 = new Geom2d_TrimmedCurve(anEllipse1 , 0 , PI); gp_Pnt2d anEllipsePnt1 = anEllipse1->Value(0); Handle(Geom2d_TrimmedCurve) aSegment = GCE2d_MakeSegment(anEllipsePnt1 , anEllipsePnt2); //Threading : Build Edges and Wires TopoDS_Wire threadingWire1 = BRepBuilderAPI_MakeWire(aEdge1OnSurf1 , aEdge2OnSurf1); BRepLib::BuildCurves3d(threadingWire1); //Create Threading aTool.AddWire(threadingWire1); TopoDS_Shape myThreading = aTool.Shape(); //Building the resulting compound aBuilder.Add (aRes, myBody); return aRes; |
This is pretty much the baseline code that comes OCC to the first line of code.
Trying: g++ -I/usr/include/opencascade -DHAVE_CONFIG_H -DHAVE_IOSTREAM -DHAVE_FSTREAM -DMAVE_LIMITS_H MakeBottle_JT.cxx
Lead to:
/tmp/ccPBD47w.o: In function Handle_Standard_Transient::~Handle_Standard_Transient()': Handle_Standard_Transient::EndScope()’/tmp/ccPBD47w.o: In function TopLoc_SListOfItemLocation::~TopLoc_SListOfItemLocation()': TopLoc_SListOfItemLocation::Clear()’collect2: ld returned 1 exit status jonas@Ubuntu4:~/OCC_bottle$ |
I was starting to research error message which led me to this link:
http://www.opencascade.org/org/forum/thread_11990/
I need to digest this a little bit.
hi
I get the same error when I try to compile any program using opencascade, how did u solve this error.
Thanks
Regards
Dhee
Well I modified my approach. Basically my objective was to get the code running so I could study it and learn from it. I wound up downloading an application called qtopencascade which actually had makebottle as part of the code.
If your using Adam Powell .deb file there’s a small modification you need to make to the .pro file (which is what I did) otherwise I think the thing should fire up (assuming you’ve loaded up the appropriate qt modules from synaptic).
There is also a sample makefile someone posted on the opencascade forum recently. I have it link in one of my more recent posts….
I hope it helps.