Tuesday, February 26, 2013

Wrappers update

This week I continued working on the xml generating code and now all the methods, constructors and enums are translated to the format used in the api files. There were some extra packages needed to run aside from the ones specified on the website (will update the information there when I finish generating the wrappers, to make sure everything is ok). The command I used was:

-cppext -cppdir out -cdldir c:\OpenCASCADE6.3.0\ros\src\ Standard MMgt TCollection Quantity TColgp TColStd Message gp TopLoc GeomAbs Geom Bnd TShort TColQuantity SortTools Resource Aspect Viewer OSD MFT PlotMgt Image Graphic2d Xw WNT AlienImage Graphic3d Visual3d V2d V3d TopAbs TopoDS Geom2d StdFail math Adaptor2d Adaptor3d Geom2dAdaptor Precision GeomAdaptor BRepAdaptor CPnts GCPnts TopTools TopExp Intrv TopBas TopTrans TopCnx IntRes2d IntAna2d IntAna Intf IntImp IntSurf IntCurveSurface HLRAlgo MeshDS MeshShape MeshAlgo Poly Prs3d PrsMgr SelectBasics Select2D Select3D SelectMgr StdSelect DsgPrs AIS BRep LProp BRepLProp BRepTools Geom2dLProp GProp TColGeom2d PLib AdvApprox GeomLProp LProp3d AdvApp2Var FEmTool AppParCurves AppCont Approx AppDef BndLib Extrema gce GC GCE2d Convert Geom2dConvert TColGeom GeomConvert GeomLib GeomProjLib GeomTools Hermit ProjLib MeshVS CGM PS Prs2d AIS2D GGraphic2d BRepLib BRepBuilderAPI Primitives BRepPrim Sweep BRepSweep BRepPrimAPI IntImpParGen IntCurve Geom2dInt TopClass BRepClass CSLib BRepTopAdaptor IntStart IntWalk IntPatch BRepIntCurveSurface IntCurvesFace BRepClass3d TopOpeBRepTool TopOpeBRepDS TopOpeBRep TopOpeBRepBuild BOPTColStd BooleanOperations GeomAPI IntTools BOPTools BOP BRepAlgo BRepAlgoAPI Law Draft BRepOffset MAT GccInt Bisector AppBlend GeomFill MAT2d BRepMAT2d ElSLib Plate GeomPlate BRepFill BRepOffsetAPI Blend BlendFunc BRepBlend ChFi2d ChFiDS ChFi3d BRepFilletAPI ChFiKPart FilletSurf PStandard PMMgt DBC PCollection PColStd PTColStd TDF Storage CDM PCDM PDF MDF CDF TDocStd TNaming TDataStd AppStdL AppStd TPrsStd TFunction Dico MoniTool LibCtl Interface Transfer IFSelect XSControl StepBasic StepData StepGeom StepShape StepRepr StepVisual StepAP203 StepAP214 STEPConstruct TransferBRep STEPControl BRepMesh BRepExtrema BRepGProp ShapeExtend ShapeAnalysis BRepCheck

This added some new classes that we didn't have at all, many of them related to Step. The run time was not affected by the newly added packages.
There are 177 packages used by the old OccWrappers.api and 205 packages we need to parse in order to export the xml files for these. I wrote a LinqPAD program to check that all the required packages were exported and another program to concatenate the classes into one file for each package.

The next step is loading these partial files in the NaroHost solution and checking that the translation was done correctly. Aside from loading the xml files, it will transform the C++ types to the types used in C# and do the Setter/Getter transformation. After the check is finished, I will incorporate the test programs in the NaroHost solutions so that the checks and file merges are done automatically.

Friday, February 22, 2013

First version of the cdl-generated xml file

Here is the first version of the xml code I got from updating the cdl parser in OcWrappers (.api file on the left, generated code on the right):

The code was generated using .edl templates and the same code that is currently used to generate the .cpp and .h files, which means that changes are easy to make, propagate automatically to all classes and the new files can be obtained quickly. I've run the parser for all the packages, all classes and all methods in OpenCascade 6.3.0 and the files were generated in 1 minute and 30 seconds.

Next week I'll change the templates for constructors, destructors and properties and 'translate' the parameter types to the types used in C#. After these are done, I will check to make sure that the templates are correct for all classes used in Naro.

Wrapper update

Over the past week I worked on updating the wrapper generator that used to generate the OCWrappers.dll. In the current workflow the OpenCascade 6.3.0 files are parsed, generating full .h and .cpp files which are then compiled in the dll. This dll is used as a base for the NaroOccCore solution which generates an .api file used to load the needed classes and methods from the dll, extracts them and generates new .cpp and .cs files.

I'm working on improving the OCWrappers code so that the Open Cascade files are parsed and the .api file is generated directly from them, without having to compile the .dll and then use reflection to extract the information we need.

Monday, February 18, 2013

Wrapper enhancements for NaroCAD

Good news for the NaroCAD project users: we decided to allocate 4 weeks of development for wrapper work starting from today.
Beside enhancing the wrappers structure we'll work also at updating them to the latest OpenCascade version and improve the wrapper generator tools. By bringing the latest OpenCascade fixes into the project we plan to have many modelling issues fixed.

Another cool surprise will be announced soon...

Released NaroCAD 1.7.6 Beta

Today we released NaroCAD 1.7.6 Beta:
- Added the Three Points Rectangle
- Added the Perpendicular line Hinter and improved the existing Hinters
- Added coordinate increments for drawing and editing sketch shapes
- Fixed Copy/Paste for Boolean solids
- Fixed the Rotate Axis Tool for sketch shapes, solids and 3D shapes
- Fixed the Property Grid Translate
- Improved the Mirror Line, Mirror Point, Array Pattern and Circular Pattern tools
- Improved the Line tool to display the length during drawing
- Fixed the Measure Tool
- Improved TreeData, NaroSketchSolve and Action Tests

You can download it here

Wednesday, February 13, 2013

Updated tests

Today and yesterday I worked on improving the tests projects and cleaning up the code:
- removed the unused MetaAction classes and related tests
- updated the test methods that create regular shapes using clicks
- fixed the MetaAction tests (Sphere, Cone, Torus, Cylinder)
- reorganized the tests and fixed their names
- fixed a bug for the Three Point Rectangle
- replaced the setup code for the NaroSketchSolve tests - this allows us to correctly configure the ActionGraph and Document and run the Solver
- fixed a path bug that caused the NaroSketchSolve tests to crash
- removed some test methods that were duplicating existing tests

There are still some tests that need to be fixed, in the TreeData project, and we need to write more tests, as the tests we have now cover the creation of nodes and only a few of the possible cases.

The Tests projects status is:

Tomorrow I will fix a Hinter bug that is causing the Perpendicular hinter line to be wrongly displayed when working with 3D objects and continue fixing the tests.

Monday, February 11, 2013

Three Points Rectangle, Measure and Tests update

Today I added the Three Points Rectangle, which gives us more flexibility when drawing rectangles, as its sides don't have to be parallel to the axes. Here is a demonstration where three rectangles are drawn on the side of an extrude:

I also fixed the Measure tool and since it is applied only on Sketch shapes, I've moved it under the Dimension tool:

As you can see, the Dimension tool is used for lines, when we want the length to remain displayed, and the measure tool when we want to check the distance between any two points on the scene.

I also updated the tests, fixed some of them and added new methods for the Mirror Point and Mirror Line tests. There are 79 TreeDataTest, with 8 failures and 2 ignored tests:

Friday, February 8, 2013

Added Perpendicular Hinter for Lines

Today I modified the unused OrthogonalLineMatch so that we'd have Perpendicular hinter lines along with the other ones. These hints are displayed correctly for the default plane for now, because of the way the NodeHelper loads axes for processing:

You can find the changes here

Thursday, February 7, 2013

Coordinate increments and hinter improvements

Today I added a new feature for the GeometricSolverPipe which allows us to specify increments for the mouse coordinates - if defined, these 'force' the mouse pointer to jump to the closest multiple of the given value for each axis. It's possible to define these increments for any of the 3 axes and change them at any point to any positive value. The Hinter suggestions are not affected by this - all points are used, even if there are some whose coordinates are not multiples of the current increments:

Another improvement added today is the addition of the origin point to the Hinter geometry:

Wednesday, February 6, 2013

Line improvements and test updating

I started updating the TreeData tests yesterday, mostly the transformation related ones. They haven't been updated after we started using the Sketch concept, so there'll be a lot of changes for them.
Aside from that, I've modified the line tool to display the length while drawing:

Tuesday, February 5, 2013

Improvements for Rotate Axis

Today I submitted the changes for the Rotate Axis tool and it's now possible to rotate a sketch shape or a 3D object around a selected axis.
The rotation is performed on the points of the selected shape(s), which on the call to ExecuteFunction for the parent node causes it to be redrawn in the correct position. The only exception is the Circle node. Because it only has one point child, we also need to perform the rotation on the circle node. The center transformation is added to the circle transformation, causing the circle wire to be positioned wrongly, so we have to add a third transformation to return the wire to the correct position.

Here is a sample for Rotate Axis on sketch:

and Rotate Axis for an extruded circle:

Monday, February 4, 2013

Fix for Translate in Property grid

Today I fixed a bug in the Property Grid Translate, which applied the given translation only for the selected node's shape instead of all the dependencies, as it should have. Here is a short demo with the correct behaviour for sketch nodes and 3D nodes:

Friday, February 1, 2013

Released NaroCAD 1.7.5 Beta

Today we released NaroCAD 1.7.5 Beta:
- Fixed Copy/Paste for sketch shapes, 3D shapes and solids
- Improved the Mirror Point and Mirror Line tools
- Improved the Array Pattern and Circular Pattern tools
- Improved Revolve to work on the entire sketch face
- Fixed Translate, Undo and Redo for solids

You can download it here

The main feature of this release is the new Paste algorithm, which processes the nodes according to their type and creates copies for all dependencies and related shapes. This allows us to create independent copies of sketch shapes, solids and complex 3D shapes which can be edited and modified separately. This new method is used for the Paste operation and for Mirror Point, Mirror Line, Array Pattern and Circular Pattern and all shapes created by these tools can be modified independently.