For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Visualize OCC shape in Open Inventor

massimo's picture
Forums: 

Hello,
I’ve tried to visualize a TopoDS_Shape in Open Inventor, transforming every face of my shape in a nurbs surface. I used the following code to do that, and it works if my shape is a prism, while if my shape is a sphere or a cone, it doesn’t work. I get a strange surface.
What’s wrong? Please help me.

I get this code from “OpenCASCADE BRep viewer” project (http://projects.opencascade.org/projects/graphperf/coin3d.htm).

In this code there's also an algorithm to mesh every surface of the shape, but I need to transform the shape in a set of nurbs surface. So I can check if the surface is flat, checkig if the control points are complanar...

This is the shape2nurbs code:

void occShape2OIVNurbs(TopoDS_Shape myShape, SoSeparator *solidSep) {

//-----------------------
// Use OpenGL NURBS
//-----------------------

TopExp_Explorer ex;
for (ex.Init(myShape, TopAbs_FACE); ex.More(); ex.Next()) {

float* mySurfaceVKnots;
float* mySurfaceUKnots;
int myNbVKnots;
int myNbUKnots;

const TopoDS_Face& aFace = TopoDS::Face(ex.Current());
Handle(Geom_Surface) aGeomSurface = BRep_Tool::Surface(aFace);
Handle(Geom_BSplineSurface) aBSplineSurface;
Standard_Boolean ok = false;
if(aGeomSurface->DynamicType() != STANDARD_TYPE(Geom_BSplineSurface)) {
// try to convert into nurbs
BRepBuilderAPI_NurbsConvert nbscv;
nbscv.Perform(aFace);
if (nbscv.IsDone()){
aGeomSurface = BRep_Tool::Surface(TopoDS::Face(nbscv.Shape()));
ok = true;
}
}
else ok = true;

if(ok) {
aBSplineSurface = Handle(Geom_BSplineSurface)::DownCast(aGeomSurface);

int myNbUPoles = aBSplineSurface->NbUPoles();
int myNbVPoles = aBSplineSurface->NbVPoles();

TColgp_Array2OfPnt aPoles(1, myNbVPoles, 1, myNbUPoles);

TColStd_Array1OfReal aVKnots(1, aBSplineSurface->NbVKnots());
TColStd_Array1OfReal aUKnots(1, aBSplineSurface->NbUKnots());

aBSplineSurface->Poles(aPoles);
aBSplineSurface->UKnots(aUKnots);
aBSplineSurface->VKnots(aVKnots);

//Push the nurbs in Coin3d

// Control Point
Standard_Integer i, j, aCounter;
int aLength = myNbVPoles*myNbUPoles; //Create array of control points and their weights

SbVec4f* mySurfaceCtrlPoints = new SbVec4f[aLength];
if(mySurfaceCtrlPoints == NULL) return;

aCounter = -1;

for(j = 1; j for(i = 1; i const gp_Pnt& aPoint = aBSplineSurface->Pole(i, j); //Control point (U,V)
mySurfaceCtrlPoints[++aCounter].setValue((float)(aPoint.X()),(float)(aPoint.Y()),(float)(aPoint.Z()),(float)(aBSplineSurface->Weight(i, j)));
}
}

TColStd_ListOfReal aListOfKnot;
TColStd_ListIteratorOfListOfReal aListOfKnotIterator;

try {
//Fill the knot`s array taking into account multiplicities
// VKnots
for(i = aVKnots.Lower(); i for(j = 1; jVMultiplicity(i); j++)
aListOfKnot.Append(aVKnots(i));
}

mySurfaceVKnots = new float[aListOfKnot.Extent()];
if(mySurfaceVKnots == NULL) return;

aCounter = -1;
for(aListOfKnotIterator.Initialize(aListOfKnot); aListOfKnotIterator.More(); aListOfKnotIterator.Next()) {
mySurfaceVKnots[++aCounter] = (float)(aListOfKnotIterator.Value());
}
myNbVKnots = aCounter+1;

// UKnots
aListOfKnot.Clear();
for(i = aUKnots.Lower(); i for(j = 1; jUMultiplicity(i); j++)
aListOfKnot.Append(aUKnots(i));
}

mySurfaceUKnots = new float[aListOfKnot.Extent()];
if(mySurfaceUKnots == NULL) return;

aCounter = -1;
for(aListOfKnotIterator.Initialize(aListOfKnot); aListOfKnotIterator.More(); aListOfKnotIterator.Next()) {
mySurfaceUKnots[++aCounter] = (float)(aListOfKnotIterator.Value());
}
myNbUKnots = aCounter+1;
}
catch(Standard_Failure) {
continue;
}

//Nurbs definition
SoNurbsSurface* surface = new SoNurbsSurface;
SoCoordinate4 *controlPts = new SoCoordinate4;
SoComplexity *comp = new SoComplexity;
comp->type.setValue(SoComplexity::OBJECT_SPACE);
comp->value = 0.5;
controlPts->point.setValues(0,aLength,mySurfaceCtrlPoints);
surface->numUControlPoints.setValue(myNbUPoles);
surface->numVControlPoints.setValue(myNbVPoles);
surface->uKnotVector.setValues(0, myNbUKnots, mySurfaceUKnots);
surface->vKnotVector.setValues(0, myNbVKnots, mySurfaceVKnots);
solidSep->addChild(comp);
solidSep->addChild(controlPts);
solidSep->addChild(surface);

delete [] mySurfaceVKnots;
delete [] mySurfaceUKnots;

}
}
}

Patrik Müller's picture

Hi,

I think you also have to add the trimming curves for SoNurbsSurface if needed?

Greets,

Patrik

massimo's picture

Ok, but how can I get the trimming curves from the TopoDS_Face converted in nurbs surface???

massimo's picture

Any reply? I can't believe that anyone made an algorithm to transform a generic surface in a nurbs...

Otherwise, someone can suggest me another method to visualize TopoDS_Shape with open inventor?

I'm waiting for your replies.
Bye!

Anup's picture

Hi Patrik,

Can you help me I hav TopoDS_Shape of .iges file that i want to convert into open inventor to display in coin3D, Please tell me the way to do this

Greets,

Anoop

Patrik Mueller's picture

Hi,

I have not used Coin3D for years. Depending on your needs, there are 2 possibilities:
a) SoNurbsSurface (more complex to do) using NURBS curves and surfaces from OCC
b) SoIndexedFaceSet: you could use the meshing result from OCC. Thats easier!

Best regards,

Patrik

Anup's picture

Hi Patrik,

Thank you so much for your reply, I got little bit idea on rendering of Open Inventor, It would be really helpful if you can give me any link or an example which shows the usage of SoIndexedFaceSet, SoNurbsSurface, Open Inventor is kind of complex library for me and i am not getting correct documents on it.

Best regards

Anup S

Anup's picture

Hi Patrik,

I tried with the code that was posted by massimo who created this post, It Worked but i am getting the shape rendering very slowly, is there any way to solve this??

Best Regards
Anup S

Patrik Mueller's picture

Hi Anup,

what's inside your sence graph? Only NURBS surfaces for the IGES shape or also other content? As written you could also try an SoIndexedFaceset. Slow speed could have a lot causes: too much stateset changes, old GPU chipset, ...

For a documentation of the different Node types look here: https://bitbucket.org/Coin3D/coin/wiki/Documentation

Greets,

Patrik

Anup's picture

Hi Patrik,

ya i have used Only NURBS surface for the IGES, may be that is causing the problem, Actually my goal is to display .stl and .iges both in same environment,
Now i will use SoIndexedFaceset for iges rendering.

Can you tell me how i can render stl?? Whether i should use SoNurbs or SoIndexedFaceset or any other is there??

It would be really helpful if you can show me a function where they have implemented SoIndexedFaceset.

Thanks & Regards
Anup S

Patrik Mueller's picture

Hi,

Coin3D could have an importer for STL (check the sources). If you want to do it by yourself take the triangles from STL and build a SoIndexedFaceset. SoNurbs doesn't make sense as STL is a mesh format!

Greets,

Patrik

Anup's picture

Hi Patrik,

I have tried with an example to read iges visualize .iges file using SoIndexedFacet, I hav attached a file with the code can you please tell me if anything is wrong in that??

The file is not getting displayed

Thanks & Regards
Anup S

Patrik Mueller's picture

Hi Anup,

if no triangulation is available, you have to create one! check the forum.

Greets,

Patrik

Anup's picture

Hi Patrik,

Create triangulation in sense?? i didn't got your point...:(

Anup's picture

Hi Patrik,

I got your point, Actually the poly_triangulation is returning NULL value, What might be the problem??

Anup's picture

Hi Patrik,

Sorry i am oly getting solutions for my questions, Just bare with me little while please, I executed this statement before the explore loop begins. and i got the shape visualized,

BRepMesh::Mesh(MyShape,2);

I don't understand what value the second parameter should be..can you tell me what should i give there?? The one which i viualized is coming darker in the sense full black not like when i render from SoStlFilekit.

If it is disturbing you over here can you message me your e-mail ID i can communicate through there itself.

Thanks & Regards
Anup S

Patrik Mueller's picture

Hi Anup,

look here: http://www.opencascade.org/org/forum/thread_16502/?forum=3

Greets,

Patrik

Anup's picture

Hi Patrik,

I went through the link you gave me even i used the Bounding Box techniwue for triangulation, The Output which i am getting in coin3D looks like this, See the image file i have attached with this messgae. Is there anything wrong??

Patrik Mueller's picture

Hi,

if there are no triangles missing, check the orientation of the triangles. Perhaps the face normals show inside the mesh.

Greets,

Patrik

Anup's picture

Hi Patrik,

I didn't got your point, when i view the image in WireFrame there are no triangles missing oly during construction of face its being filled blank, See the image i hav sent,

Greets,
Anup

Patrik Mueller's picture

As said, check the normals. If backface culling is activated for Coin3D, triangles with "reversed" face normals will not be rendered.

Greets,

Patrik

Anup's picture

Hi Patrik,

Thank you so much for your help, I changed that backface culling and it worked, Thank you very very much,

Last but not least can you tell me how i can select few points in IGES file and select few points in STL File and do boolean operation to them??

When i searched in web most of them referred to SoSelection for selecting and using BRepAlgoAPI_BooleanOperation for boolean operation....

Is it the right way to do it?? or is there any other way??

Looking forward for your reply.

Thanks & Regards
Anup S

Anup's picture

Hi Patrik,

And one more thing when i import STL and IGES in coin3d i mean in same environment both of them will rotate on mouse action how to stop one file from rotating?? So that i can view only one file.

And while doing boolean operation can i bring two objects together using mouse event or it has to be donw by selecting points from two objects and then doing boolean operation??

Oh And i can't able to visualize STL File of larger size using opencascade but it can be visualized using coin3D s inbuilt library, I found in forms that it can be read using MeshVS_Mesh.. How can i Visualize this in coin3D..Please help..

Thanks & Regards
Anup S

Patrik Mueller's picture

Hi Anup,

please check the Coin3D documetation and samples for such questions! You should find enough informations about selecting and rotation for OpenInventor!

I don't know what you mean with selecting points and doing boolean operations. But you can't do CSG with a mesh and a shape. You could build a shape from a mesh, but it needs a lot of time and memory.
And I don't understand your last question: what do you want to do: displaying a MeshVS_Mesh in Coin3D? Why, if you could load the STL by coin3D?

Greets,

Patrik

Anup's picture

Hi Patrik,

The selection of points in sense consider for instance i have a mesh file(STL) some bone structure and i have IGES File can be an implant, I want to join both of these objects based on user selection.

The Coin3D s STL import library works fine but for some files the surface is not visible when i visualize using Wireframe i can visualize but not in normal mode, The reason i m restricted coin3D s import library is that i need to combine both files so if i had imported using OCC Libarry i thought it would be easy for me.

Greets,
Anup

Patrik Mueller's picture

Hi Anup,

still a little bit confused: do you really need a topological CSG or just a visualization grouping? the later would be easy.
Again for the visibility of triangles: you could check the face normal orientations!
And how do you import the IGES files from OCC:
a) IGES -> STL -> Coin3D
b) IGES -> Meshing ->Coin3D

Greets,

Patrik

Anup's picture

Hi Patrik,

I am Importing files in this way
1. IGES->OCC->Meshing->Coin3D.
2. STL->OCC->Coin3D.

Now user can select some two points in IGES and two points in STL after tat they are joined then i need to export both of them using NURBS. This is my task

Greets
Anup

Anup's picture

Hi Patrik,

I am Importing files in this way
1. IGES->OCC->Meshing->Coin3D.
2. STL->OCC->Coin3D.

Now user can select some two points in IGES and two points in STL after tat they are joined then i need to export both of them using NURBS. This is my task

Greets
Anup

Patrik Mueller's picture

Hi,

ok - I would not recoomend it, but how about this:

- read a shape from STL via OCC. Its slow, but if you also need it for CSG you have one
- for visualization you could also mesh it. Perhaps this solves your problem with orientations

Greets,

Patrik

Anup's picture

Hi Patrik,

I had already done the way u have mentioned right now, I have attached a image file with this msg, I was able to visualize STL files via OCC with meshing i didn't any orientation problem but when i try to load a STL file of size 85 M.B, I am getting that error.

Greets,
Anup

Anup's picture

Hi Patrik,

I have attached the code with this message, So that you can tell me where is the mistake, And can you please give me your mail ID in Gmail or something, Every time i need to post here for my clarifications, It would be helpful for me to contact you.

Thanks & Regards
Anup S

Patrik Mueller's picture

Hi,

looks ok at a first sight. Check your call stack for the exception. Perhaps you could get more infos. And in VS, enable all Exceptions in the debug options.

Greets,

Patrik

Anup's picture

Hi Patrik,

I don't know how to do that call stack for exception, I ve gone through the web on that call stack and debug options as well, I have attached an image with this message that is what i got, I didn't understood anything from it, If that s not the way to deal with call stack then tell me how can i do it.

Thanks & Regards
Anup

Patrik Mueller's picture

hi anup,

the attachment has 0 bytes! But looking inside VS documentation or do a web search for stack trace should give you more than enough informations...

Greets,

Patrik

Anup's picture

Hi Patrik,

Sorry they hav removed all my previous files too..don't know i coidn't access forms from 2 days. I have attached tat image with this message hope u r able to open it now.

Thanks & Regards
Anup S

Attachments: 
Patrik Mueller's picture

Hi Anup,

you have to find the problem by yourself. The screenshot just shows one line of code. In the call stack you should find the right informations (which method, ...).

Greets,

Patrik

Anup's picture

Hi Patrik,

Thank you so much for your suggestion, One more thing i am working on this manipulators and draggers in coin3D, Actually i executed the example given in OpenInventor Manual, It is working properly, Now i am trying to attach the manipulator and dragger to the Iges file which i hav visualized using IndexedFacet, The Following function is called in the example which they have given, They are using callback function with SoSelection to select the nodes in the graph.

void selectionCallback(void *, SoPath *selectionPath)
{
// Attach the manipulator.
// Use the convenience routine to get a path to
// the transform that effects the selected object.
SoPath *xformPath = createTransformPath(selectionPath);
if (xformPath == NULL) return;
xformPath->ref();

// Attach the handle box to the sphere,
// the trackball to the cube
// or the transformBox to the wrapperKit
if (selectionPath->getTail()->isOfType(
SoSphere::getClassTypeId())) {
handleBoxPath = xformPath;
myHandleBox->replaceNode(xformPath);
}
else if (selectionPath->getTail()->
isOfType(SoCube::getClassTypeId())) {
trackballPath = xformPath;
myTrackball->replaceNode(xformPath);
}
}

And The Below function for creating TransformPath
SoPath *
createTransformPath(SoPath *inputPath)
{
int pathLength = inputPath->getLength();
if (pathLength return NULL;

SoNode *tail = inputPath->getTail();

// CASE 1: The tail is a node kit.
// Nodekits have built in policy for creating parts.
// The kit copies inputPath, then extends it past the
// kit all the way down to the transform. It creates the
// transform if necessary.
if (tail->isOfType(SoBaseKit::getClassTypeId())) {
SoBaseKit *kit = (SoBaseKit *) tail;
return kit->createPathToPart("transform",TRUE,inputPath);
}

SoTransform *editXf = NULL;
SoGroup *parent;
SbBool existedBefore = FALSE;

// CASE 2: The tail is not a group.
SbBool isTailGroup;
isTailGroup = tail->isOfType(SoGroup::getClassTypeId());
if (!isTailGroup) {
// 'parent' is node above tail. Search under parent right
// to left for a transform. If we find a 'movable' node
// insert a transform just left of tail.
parent = (SoGroup *) inputPath->getNode(pathLength - 2);
int tailIndx = parent->findChild(tail);

for (int i = tailIndx; (i >= 0) && (editXf == NULL);i--){
SoNode *myNode = parent->getChild(i);
if (myNode->isOfType(SoTransform::getClassTypeId()))
editXf = (SoTransform *) myNode;
else if (i != tailIndx && (isTransformable(myNode)))
break;
}
if (editXf == NULL) {
existedBefore = FALSE;
editXf = new SoTransform;
parent->insertChild(editXf, tailIndx);
}
else
existedBefore = TRUE;
}
// CASE 3: The tail is a group.
else {
// Search the children from left to right for transform
// nodes. Stop the search if we come to a movable node.
// and insert a transform before it.
parent = (SoGroup *) tail;
int i;
for (i = 0;
(i getNumChildren()) && (editXf == NULL);
i++) {
SoNode *myNode = parent->getChild(i);
if (myNode->isOfType(SoTransform::getClassTypeId()))
editXf = (SoTransform *) myNode;
else if (isTransformable(myNode))
break;
}
if (editXf == NULL) {
existedBefore = FALSE;
editXf = new SoTransform;
parent->insertChild(editXf, i);
}
else
existedBefore = TRUE;
}

// Create 'pathToXform.' Copy inputPath, then make last
// node be editXf.
SoPath *pathToXform = NULL;
pathToXform = inputPath->copy();
pathToXform->ref();
if (!isTailGroup) // pop off the last entry.
pathToXform->pop();
// add editXf to the end
int xfIndex = parent->findChild(editXf);
pathToXform->append(xfIndex);
pathToXform->unrefNoDelete();

return(pathToXform);
}

Now What i want is to select the Iges File which is in a IgesRoot(SoSeparator), In the Above function they have taken the ClassTypeID using SoCude->getClassTypeID() which will select the particular from the main ROOT, I used SoSeparator->getClassTypeID() but i am not able to slect my IGESRoot, Please help me...Looking Forward for your reply

Thanks & Regards
Anup S

Patrik Mueller's picture

Hi Anup,

how about this: store the pointer to your SoIndexedFaceSet somewhere in your app. In the selection callback, check if getTail() is on the same address.

Greets,

Patrik

Anup's picture

Hi Patrik,

I didn't got your first point store pointer to SoIndexedFaceSet means storing a sample pointer address??

I have attached a txt file with this message plz go through tat, Coz When i went through the debugging mode using break points At First i tried with the SoCube and then i tried with the SoIndexedFacet which has the IgesShape stored, The file shows the values of returned by getTail() Function, Can u plz see to it and tell me how to resolve this...Looking Forward for your reply

Thanks & Regards
Anup

Attachments: 
Anup's picture

Hi Patrik,

How to switch on the BackFace Culling For SoSTLFileKit i mean I hav read an STL File Using a pointer of SoSTLFileKit and Stored the scene in a SoNode.
Now I want to turn on the backface Culling How to use the below statements beacuse there isn't any function called set(SoShapeHints) to set the backface culling either in SoSTLFileKit or SoNode.

// node for defining the shape and enabling backface culling
SoShapeHints *hint = new SoShapeHints;
hint->shapeType.setValue(SoShapeHints::UNKNOWN_SHAPE_TYPE);
hint->vertexOrdering.setValue(SoShapeHints::COUNTERCLOCKWISE);

// Normal binding
SoNormalBinding *myNormalBinding = new SoNormalBinding;
myNormalBinding->value = SoNormalBinding::PER_VERTEX_INDEXED;

How do i set these values *hint and *myNormalBinding?? Please Help, Looking forward for your reply.

Thanks & Regards
Anup S

Anup's picture

Hi Patrik,

As i had imported an Iges and STL file to coin3D(OCC->coin3D) can i go the other direction i mean i will use SoNode * OldNode = ExaminerViewer->getSceneGraph(); to store the shapes in coin3D to SoNode,

My question is after getting the node from scene graph can i convert it to TopoDS_Shape for writing into a file (coin3D->OCC->STL or IGES File) ??

Please give reply to this i am not getting any answer for this anywhere

Thanks & Regards
Anup S

Patrik Mueller's picture

Hi Anup,

please study the relevant docs for your Coin questions! For STL:

https://bitbucket.org/Coin3D/coin/src/3ba6b414273e/src/foreignfiles/SoSTLFileKit.cpp

Greets,

Patrik

Anup's picture

Hi Patrik,

Thank you so much i got tat info about STL Files in Coin3D, I am facing these two problems which i am desperately looking for solution.

1.
I am trying to use Maniupulators and Draggers for IGES imported in viewer. I hav used the Following SelectionCallBack Method
void
selectionCallback(
void *, // user data is not used
SoPath *selectionPath)
{
int length = selectionPath->getLength();
SoPath *xformPath = createTransformPath(selectionPath);
if (xformPath == NULL) return;
xformPath->ref();

trackballPath = xformPath;
myTrackball->replaceNode(xformPath);
}

And The CreateTrasformPath method is as follows

SoPath *
createTransformPath(SoPath *inputPath)
{
int pathLength = inputPath->getLength();
if (pathLength return NULL;

SoNode *tail = inputPath->getTail();

// CASE 1: The tail is a node kit.
// Nodekits have built in policy for creating parts.
// The kit copies inputPath, then extends it past the
// kit all the way down to the transform. It creates the
// transform if necessary.
if (tail->isOfType(SoBaseKit::getClassTypeId())) {
SoBaseKit *kit = (SoBaseKit *) tail;
return kit->createPathToPart("transform",TRUE,inputPath);
}

SoTransform *editXf = NULL;
SoGroup *parent;
SbBool existedBefore = FALSE;

// CASE 2: The tail is not a group.
SbBool isTailGroup;
isTailGroup = tail->isOfType(SoGroup::getClassTypeId());
if (!isTailGroup) {
// 'parent' is node above tail. Search under parent right
// to left for a transform. If we find a 'movable' node
// insert a transform just left of tail.
parent = (SoGroup *) inputPath->getNode(pathLength - 2);
int tailIndx = parent->findChild(tail);
//tailIndx = 3;
for (int i = tailIndx; (i >= 0) && (editXf == NULL);i--){
SoNode *myNode = parent->getChild(i);
if (myNode->isOfType(SoTransform::getClassTypeId()))
editXf = (SoTransform *) myNode;
else if (i != tailIndx && (isTransformable(myNode)))
break;
}
if (editXf == NULL) {
existedBefore = FALSE;
editXf = new SoTransform;
parent->insertChild(editXf, tailIndx);
}
else
existedBefore = TRUE;
}
// CASE 3: The tail is a group.
else {
// Search the children from left to right for transform
// nodes. Stop the search if we come to a movable node.
// and insert a transform before it.
parent = (SoGroup *) tail;
int i;
for (i = 0;
(i getNumChildren()) && (editXf == NULL);
i++) {
SoNode *myNode = parent->getChild(i);
if (myNode->isOfType(SoTransform::getClassTypeId()))
editXf = (SoTransform *) myNode;
else if (isTransformable(myNode))
break;
}
if (editXf == NULL) {
existedBefore = FALSE;
editXf = new SoTransform;
parent->insertChild(editXf, i);
}
else
existedBefore = TRUE;
}

// Create 'pathToXform.' Copy inputPath, then make last
// node be editXf.
SoPath *pathToXform = NULL;
pathToXform = inputPath->copy();
pathToXform->ref();
if (!isTailGroup) // pop off the last entry.
pathToXform->pop();
// add editXf to the end
int xfIndex = parent->findChild(editXf);
pathToXform->append(xfIndex);
pathToXform->unrefNoDelete();

return(pathToXform);
}

The Problem which i am facing is in createTransformPath(SoPath *inputPath) method

The Following statement returns tail index
int tailIndx = parent->findChild(tail);

When i click on one face of IGES(Cylinder) the tailIndx has value 3 it selects whole object properly no problem in tat in same way when click on other face of cylinder the tailIndx has value 7 which transforms only two faces of cylinder the rest of faces will be still.

My next Problem is.

2.
As i had imported an Iges and STL file to coin3D(OCC->coin3D) can i go the other direction i mean i will use SoNode * OldNode = ExaminerViewer->getSceneGraph(); to store the shapes in coin3D to SoNode,

My question is after getting the node from scene graph can i convert it to TopoDS_Shape for writing into a file (coin3D->OCC->STL or IGES File) ??

Please give reply to this i am not getting any answer for this anywhere

Thanks & Regards
Anup S

Patrik Mueller's picture

Hi Anup,

I'm afraid you have to find a solution for 1. by yourself.

But for 2: as written, why don't you use SoSTLFileKit for generating the STL file and use it inside OCC?

Greets,

Patrik

Anup's picture

Hi Patrik,

When i import IGES File and go with triangulation using BRep_Tool::Triangulation(aFace,aLoc) is it possible to change triangles in counterclockwise order??? if i change it then i can easily import using coin3D s inbuilt STL library.

Greets,
Anup

Patrik Mueller's picture

www.opencascade.org/org/forum/thread_25699/

Anup's picture

Hi Patrik,

Actually i am trying manipulator and dragger on two files, Consider i hav imported two STL Files usin SoSTLFileKit and i hav two trackball manipulator i.e., myTrackBall_1 and myTrackBall_2.

Now in SelectionCallBack function in below,
void selectionCallback(void *, SoPath *selectionPath)
{
SoPath *xformPath = createTransformPath(selectionPath);
if (xformPath == NULL) return;
xformPath->ref();

if (selectionPath->getHead()->isOfType(SoGroup::getClassTypeId()))
{
TrackballPath = xformPath;
myTrackball->replaceNode(xformPath);
}
}

Before assigning xformPath to myTrackball i am not getting how to differentite that i have to give it to myTrackBall_1 or myTrackBall_2???

If i give both of them both then when i click on second file which was imported it myTrackBall_1 will invoke and then myTackBall_2. Can u help me out here please...

Thanks & Regards
Anup S

Anup's picture

Hi Patrik,

I have resolved the previous issue, Can u tell me how can i export the changed co-ordinates of a shape to a file?? i.e., If u have a cube and a sphere in SceneGraph after u join both of them using Manipulator i need to export the joined shape as a single file...

How can i do this??

Thanks & Regards
Anup S

Patrik Mueller's picture

Hi Anup,

have you tried it with SoSTLFileKit?

Anup's picture

Hi Patrik,
Ya i have tried using SoSTLFileKit, It will export how the files was imported to viewer. In Sense, if u have two STL Files a Sphere and Cube when imported it will be in different co-ordinates after when i join both of them using a manipulator and then export the combined shape using SoNode * Exp = ExaminerViewer->getSceneGraph() and then giving SoNode to SoSTLFileKit The File Contains both Sphere and Cube but not the combined one..:(

Thanks & Regards
Anup S

Patrik Mueller's picture

Hi Anup,

on the IvFix folder are some classes for merging and so on. Perhaps merging the to nodes before the output could help...

Greets,

Patrik

CONNECT WITH US

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.