Friday, February 13, 2009

Closed Iteration 0.0.7

The tasks proposed for this iteration were mostly completed, even some of the lower priority tasks were finished:
- improved the Extrude code, added MidPlane extrusion,
- added a parametric modeling solver that propagates the changes on related entities. Ex: when an extrude is applied on a shape if the shape is changed also the extrude is regenerated,
- added logging with log4net,
- finished implementing the selection mechanism: when an object is selected on the tree list it is also selected in the graphical view and also in the property grid. The selection is made by clicking on an item from the tree and also dynamically on mouse over the items,
- shape modifications from property grid or from graphical view can all be reverted. The Undo/Redo mechanism works properly,
- started working at adding constraints and helpers. At the Sketcher adding markers at the shapes, almost implemented at the line code that allows the user to modify the line by dragging the markers from its ends,
- prepared an installer for the application,
- added for developers a debug window that shows the OCAF data tree, this will be useful on the development process at investigating the data changes,
- started refactoring the code. In order to integrate the command line the commands have to be decoupled from the view.

Tomorrow will prepare the list with the tasks for the iteration 0.0.8 and will also update the documentation.

Among the tasks that will be included in the next iteration are:
- finish implementing the shape modifications by dragging the markers from the end of it, improve the Sketcher,
- improve the 2d to 3d transition,
- improve the Fillet feature by adding the radius and if possible a progressive radius change,
- finish implementing Cut with OCAF and add also some Cut properties,
- code refactoring and cleanup,
- command line functionality,
- nUnit testing,
- put in place a documentation generation tool,
- start using TargetProcess for the development process.

7 comments:

entery said...

Hi..
Thanks for keeping up the good work!
Anyway Im new to this OCC library.
I jst wonder how to connect two or more circles?
Im using:
OCBRepBuilderAPI_MakeEdge makeEdge1 = new OCBRepBuilderAPI_MakeEdge(aCircle);
OCBRepBuilderAPI_MakeEdge makeEdge2 = new OCBRepBuilderAPI_MakeEdge(aCircle2);

OCTopoDS_Edge aEdge1 = makeEdge1.Edge();
OCTopoDS_Edge aEdge2 = makeEdge2.Edge();

OCBRepBuilderAPI_MakeWire makeWire = new OCBRepBuilderAPI_MakeWire(aEdge1, aEdge2);
// This crashing the applicaton :(
OCTopoDS_Wire aWire = makeWire.Wire();

So What would be the right way to connect 2 or more circles?

Regards
entery

bxtrx said...

Hi,

I tried your sample in C++ and it is also crashing:

gp_Circ circle(gp_Ax2(gp_Pnt(-300,0,0),gp_Dir(1,0,0)),80);
gp_Circ circle2(gp_Ax2(gp_Pnt(-200,0,0),gp_Dir(1,0,0)),100);

TopoDS_Edge aEdge1 = BRepBuilderAPI_MakeEdge(circle);
TopoDS_Edge aEdge2 = BRepBuilderAPI_MakeEdge(circle2);

TopoDS_Wire aWire = BRepBuilderAPI_MakeWire(aEdge1, aEdge2).Wire();
if (aWire.IsNull())
{
return;
}

I think the problem is not related to the wrappers but to the circles you create. I don't know what is the condition to create a wire but probably the shapes should be connected.

For some working sample please look in the trunk\wrappers\OCWrappers.sln project. There is the MakeBottle ported project and that works (it creates a wire from 3 edges). Some ported sample code:

// Profile : Define Support Points
OCgp_Pnt aPnt1 = new OCgp_Pnt(-myWidth / 2, 0, 0);
OCgp_Pnt aPnt2 = new OCgp_Pnt(-myWidth / 2.0, -myThickness / 4.0, 0);
OCgp_Pnt aPnt3 = new OCgp_Pnt(0, -myThickness / 2.0, 0);
OCgp_Pnt aPnt4 = new OCgp_Pnt(myWidth / 2.0, -myThickness / 4.0, 0);
OCgp_Pnt aPnt5 = new OCgp_Pnt(myWidth / 2.0, 0, 0);

// Profile : Define the Geometry
OCGC_MakeArcOfCircle makeCircle = new OCGC_MakeArcOfCircle(aPnt2, aPnt3, aPnt4);
OCGC_MakeSegment makeSegment1 = new OCGC_MakeSegment(aPnt1, aPnt2);
OCGC_MakeSegment makeSegment2 = new OCGC_MakeSegment(aPnt4, aPnt5);

OCGeom_TrimmedCurve aArcOfCircle = makeCircle.Value();
OCGeom_TrimmedCurve aSegment1 = makeSegment1.Value();
OCGeom_TrimmedCurve aSegment2 = makeSegment2.Value();

// Profile : Define the Topology
OCBRepBuilderAPI_MakeEdge makeEdge1 = new OCBRepBuilderAPI_MakeEdge(aSegment1);
OCBRepBuilderAPI_MakeEdge makeEdge2 = new OCBRepBuilderAPI_MakeEdge(aArcOfCircle);
OCBRepBuilderAPI_MakeEdge makeEdge3 = new OCBRepBuilderAPI_MakeEdge(aSegment2);

OCTopoDS_Edge aEdge1 = makeEdge1.Edge();
OCTopoDS_Edge aEdge2 = makeEdge2.Edge();
OCTopoDS_Edge aEdge3 = makeEdge3.Edge();

OCBRepBuilderAPI_MakeWire makeWire = new OCBRepBuilderAPI_MakeWire(aEdge1, aEdge2, aEdge3);

OCTopoDS_Wire aWire = makeWire.Wire();


Best regards,
Mihai

entery said...

Thanks for your fast reply.
What im trying to is;
Say you have defined
some points in XZ plane and wish to create one object by rotating
it around the Z axis. I've done this in DirectX, but
im kind of stuck with OCC.

The url under shows a picture, that tries to describe what I want to do ;o)

http://img88.imageshack.us/img88/1305/nozzleez1.png

Is it any easy way to do this in OCC?

In DirectX, I first defined the points, then I created faces (triangles) around the axis. With a step increment on eg. 10*

bxtrx said...

Hi,

The feature you want to implement is called Revolve in OCC.

This can be done using the BRepFeat_MakeRevol. Please see a sample at the page 110 in the Modeling Algorithm User Guide from OpenCascade for explanations. This algo can be implemented also using the BRepPrimAPI, please look in the same user guide for samples.

In the OCC/samples/standard/mfc there is a C++ sample application named TopologyLocalOperation where you can see a revolve sample.

I don't have this implemented in NaroCad for the moment, there is no such code in Naro.

Best regards,
Mihai

entery said...

Thank You Mihai!
You Just Saved My Day!

entery said...

Hi Mihai,
Sorry to bother you again...
Im looking on the sample you suggested. And I run into one problem with the OCBRepLib.BuildCurve3d function.
In the sample this function take a OCTopoDS_Face as in parameter, while the function available in the wrapper using an OCTopoDS_Edge + some extra in parameters.
Do you know about some easy workaround for this?

Best Regards!

Entery

entery said...

Hi again ;o)
I made it work by using OCBRepPrimAPI_MakeRevol instead.
It worked just the way I was hoping for.

Thanks alot!