tag:blogger.com,1999:blog-3285677929777490656.post7106978172009226119..comments2023-10-31T13:16:01.375+03:00Comments on Open CASCADE notes: Topology and Geometry in Open CASCADE. Part 2Roman Lyginhttp://www.blogger.com/profile/18338419158437898791noreply@blogger.comBlogger11125tag:blogger.com,1999:blog-3285677929777490656.post-55743124463381838902011-06-17T13:37:14.917+04:002011-06-17T13:37:14.917+04:00Hi Roman,
I am new to OpenCascade. I wanted to as...Hi Roman,<br /><br />I am new to OpenCascade. I wanted to ask if it is possible to define the coordinates in a gp_Pnt function as variables and take their values from other classes?<br />like gp_Pnt (x,y,z) and I am getting the values of x,y,z from other classes.<br />Thanks.<br />NitinNitinhttps://www.blogger.com/profile/07195983976685455267noreply@blogger.comtag:blogger.com,1999:blog-3285677929777490656.post-21012796566240787772011-01-19T17:39:24.119+03:002011-01-19T17:39:24.119+03:00Obviously, the first if should read as :
if (aSurf...Obviously, the first if should read as :<br />if (aSurf->IsKind (STANDARD_TYPE (Geom_Plane))) {<br />Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast (aSurface);<br />//do plane-specific stuff...Roman Lyginhttps://www.blogger.com/profile/18338419158437898791noreply@blogger.comtag:blogger.com,1999:blog-3285677929777490656.post-85071239389953304242011-01-19T15:14:11.198+03:002011-01-19T15:14:11.198+03:00Hi Davood,
Glad to see you now on my blog.
First ...Hi Davood,<br /><br />Glad to see you now on my blog.<br />First off, to read ACIS-SAT file you will need to use CAD Exchanger SDK and its ACIS importer.<br />Then you will need to explore faces (topological entities that bound surfaces) using Open CASCADE API. Doing so you can retrieve underlying surfaces and calculate 3D points using (u, v) coordinates. Each surface has a predefined parametrization – e.g. a plane is a parametrized in u and v along its X- and Y- axes respectively. Surface of revolution is parameterized in u along the rotation angle, and in v - along the generatrix curve, and so on. Alternatively you can project 3D points on surface to get (u,v) coordinates, etc. It’s all depends upon your needs.<br /><br />Here is a (pseudo-)code that would do this:<br /><br />//use CAD Exchanger to read-in the .sat file into Open CASCADE model<br />ACIS_Reader aReader;<br />Handle_Base_ShapeModel aModel;<br />if (aReader.ReadFile ("myfile.sat") && aReader.Transfer (aModel)) {<br /> //iterate over model roots<br /> const Base_ShapeModel::ListOfHShapes& aRootL = aModel->Roots();<br /> Base_ShapeModel::ListOfHShapes::const_iterator anIt = aRootL.begin();<br /> for (; anIt != aRootL.end(); ++anIt) {<br /> Handle(TopoDS_HShape) aHShape = Handle(TopoDS_HShape)::DownCast (*anIt);<br /> if (!aHShape.IsNull()) {<br /> const TopoDS_Shape& aShape = aHShape->Shape();<br /> <br /> //iterate over faces of i-th root<br /> for (TopExp_Explorer anExp (aShape, TopAbs_FACE); anExp.More(); anExp.Next()) {<br /> const TopoDS_Face& aFace = TopoDS::Face (anExp.Current());<br /> Handle(Geom_Surface) aSurf = BRep_Tool::Surface (aFace);<br /><br /> //do what you need with the surface<br /> if (aSurf->IsKind (STANDARD_TYPE ())) {<br /> Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast (aSurface);<br /> //do plane-specific stuff...<br /> } else if (aSurf->IsKind (STANDARD_TYPE (Geom_SphericalSurface))) {<br /> //do sphere-specific stuff...<br /> } else <br />...<br /> }<br />...<br />}<br /><br />RomanRoman Lyginhttps://www.blogger.com/profile/18338419158437898791noreply@blogger.comtag:blogger.com,1999:blog-3285677929777490656.post-21077650720193319892011-01-18T19:07:14.593+03:002011-01-18T19:07:14.593+03:00Hi
I just found about your notes on OCC.
And I fou...Hi<br />I just found about your notes on OCC.<br />And I found them very helpful.<br />I am trying to do some Numerical Computation <br />and I need to access the individual patches (surfaces) an object is made from in the sense <br />that I need to have a (u,v) parametrization of the surfaces. The actual model is an ACIS file and I am not sure using OCC can get me to what I need. Can you give me some adivice please ?<br /><br />Thankxdavoodhttps://www.blogger.com/profile/00712235054655483408noreply@blogger.comtag:blogger.com,1999:blog-3285677929777490656.post-24908514606631850012010-03-10T07:20:47.349+03:002010-03-10T07:20:47.349+03:00Thanks Roman...now it's getting clearer...I wi...Thanks Roman...now it's getting clearer...I will study BrepBuilder from your notes and code. I guess with meshing in mind, I may have to implement that then..again, thank you for all your effort.<br /><br />Regards,<br /><br />Venuprajnatarahttps://www.blogger.com/profile/08013077703018428274noreply@blogger.comtag:blogger.com,1999:blog-3285677929777490656.post-22099555531235759372010-03-10T00:41:25.309+03:002010-03-10T00:41:25.309+03:00Venu, if you compare with MVC(model-view-controlle...Venu, if you compare with <a href="http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller" rel="nofollow">MVC</a>(model-view-controller), TopoDS_Shape or OCAF is your model, and AIS is a mix of view and controller. So you may operate at AIS level (creating, visualizing and moving around some points) as long as you need, but if you eventually need a data to store/retrieve, create complex CAD model, mesh on it, etc you obviously need a model component. This is where TopoDS_Shape comes in. Again, BRep_Builder is a just a low-level tool to create shapes bottom up, there are higher level API methods to facilitate some pre-defined primitives.<br />Hope this helps a bit.<br />RomanRoman Lyginhttps://www.blogger.com/profile/18338419158437898791noreply@blogger.comtag:blogger.com,1999:blog-3285677929777490656.post-47827617364909265172010-03-07T01:47:06.306+03:002010-03-07T01:47:06.306+03:00Thanks Roman, greatly appreciate your effort and t...Thanks Roman, greatly appreciate your effort and time you are putting to for people like me. One question, I kind of understand what you are saying but when I place/create an AIS_Point (or any AIS geometrical entity) is it not building it and then displaying it? <br /><br />In my small application, all my 2d geometrical quantities are AIS objects, so that I can change them interactively...if I am not building them, should be implementing a Brep builder? my ultimate goal is to have an application which can used to build CAD objects and then mesh them...please advice if I also have to implement Brep builder eventually...thanks again for your beautiful notes...I am learning a lot from your notes.<br /><br />Thanks,<br /><br />Venuprajnatarahttps://www.blogger.com/profile/08013077703018428274noreply@blogger.comtag:blogger.com,1999:blog-3285677929777490656.post-3743422573953181492010-03-06T12:54:47.421+03:002010-03-06T12:54:47.421+03:00Aah, looked again at AIS_Point. Of course, it does...Aah, looked again at AIS_Point. Of course, it does not display a vertex (TopoDS_Vertex). It just displays an auxiliary point on the screen, i.e. has no relationship to your 3D model.<br />AIS_Shape does display a vertex, like any other TopoDS_Shape.<br />Sorry for initial misleading comment.Roman Lyginhttps://www.blogger.com/profile/18338419158437898791noreply@blogger.comtag:blogger.com,1999:blog-3285677929777490656.post-23566005773532069952010-03-06T12:44:29.541+03:002010-03-06T12:44:29.541+03:00Hi Venu,
BRep_Builder is a way to build a vertex. ...Hi Venu,<br />BRep_Builder is a way to build a vertex. <br />AIS_Point to display it. No confusion ;-).<br /><br />BRep_Builder is an underlying low-/medium-level way to build shapes bottom-up. As usual, there are higher level, convenience, API. For instance as follows:<br />TopoDS_Vertex aV = BRepBuilderAPI_MakeVertex (gp_Pnt (x, y, z));<br />It uses BRep_Builder internally but you don't see it.Roman Lyginhttps://www.blogger.com/profile/18338419158437898791noreply@blogger.comtag:blogger.com,1999:blog-3285677929777490656.post-36910906237658671492010-03-04T18:13:52.050+03:002010-03-04T18:13:52.050+03:00Hi Roman,
I have a question, you said one must us...Hi Roman,<br /><br />I have a question, you said one must use BRep_Builder to build the vertex as you shown above. Pardon my ignorance, when should then one use AIS_Point to display an interactive point? can one still use AIS_Point to display a point? I am bit confused with the use of BRep_Builder, I have a small application for sketching 2d geometries where I have not used BRep_Builder. I am completely new to CAD programming, so please be kind to me :)<br /><br />Thanks,<br />Venuprajnatarahttps://www.blogger.com/profile/08013077703018428274noreply@blogger.comtag:blogger.com,1999:blog-3285677929777490656.post-86424041617847709642009-02-09T21:17:00.000+03:002009-02-09T21:17:00.000+03:00nice guynice guyUnknownhttps://www.blogger.com/profile/02202028247813135600noreply@blogger.com