[SOLVED]OpenSCAD or OCC.Core ? for low level manupulating?

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
mariwan
Posts: 469
Joined: Wed Jan 06, 2021 2:00 pm

[SOLVED]OpenSCAD or OCC.Core ? for low level manupulating?

Post by mariwan »

Hi,
Defeaturing WB which is made by @easyw-fc uses OpenSCADCommands to manupulate the 3D objects, but @loooo suggested at some time using the OCC.Core.

I have not so much knowledge about how these are different, and which one should I use. If OpenSCAD is the core engine of FreeCAD what is OCC.core?
This question related to a very lowlevel API which I don't think there are many developers know about it. But maybe some one help me to put my first step in digging in this engine in the right way .. not spending time in awrong direction.

Link to place where @loooo suggested adding new functionality to FreeCAD

Code: Select all

https://github.com/looooo/freecad.gears/issues/50
and @easyw-fc code :

Code: Select all

https://github.com/easyw/Defeaturing_WB/blob/master/DefeaturingTools.py
Thanks a lot .
Last edited by mariwan on Sun Nov 14, 2021 5:34 pm, edited 1 time in total.
User avatar
adrianinsaval
Veteran
Posts: 5551
Joined: Thu Apr 05, 2018 5:15 pm

Re: OpenSCAD or OCC.Core ? for low level manupulating?

Post by adrianinsaval »

FreeCAD's geometric kernel is opencascade (OCC), OpenSCAD is a script based CAD program.
ickby
Veteran
Posts: 3116
Joined: Wed Oct 05, 2011 7:36 am

Re: OpenSCAD or OCC.Core ? for low level manupulating?

Post by ickby »

Occ (open cascade) is what freecad uses in the part and part design workbenches and hence by all other workbenches based on that (so almost all of them)

Openscad is used in a special openscad workbench and for some special niche operations.

On a fundamental level Occ (open cascade) is a BRep library, openscad a mesh library. The results of openscad are in general only usable as a mesh in freecad, and hence can be handled only by tools from the mesh workbench. All part and part design tools and APIs are not usable with openscad generated things.
User avatar
mariwan
Posts: 469
Joined: Wed Jan 06, 2021 2:00 pm

Re: OpenSCAD or OCC.Core ? for low level manupulating?

Post by mariwan »

So, I was confused about OpenSCAD and Open CASCADE.
Which Open CASCAD must be the OCC core?
am I correct?
david69
Veteran
Posts: 1780
Joined: Wed Jan 01, 2014 7:48 pm

Re: OpenSCAD or OCC.Core ? for low level manupulating?

Post by david69 »

give a look to the wiki OpenSCAD_Workbench.
ickby
Veteran
Posts: 3116
Joined: Wed Oct 05, 2011 7:36 am

Re: OpenSCAD or OCC.Core ? for low level manupulating?

Post by ickby »

hm seemed it was too early for me to write a text, I corrected the mistakes now in my post, sorry.
User avatar
mariwan
Posts: 469
Joined: Wed Jan 06, 2021 2:00 pm

Re: OpenSCAD or OCC.Core ? for low level manupulating?

Post by mariwan »

But seems to me that De-featuring WB uses OpenSCADCommands which is not the CORE of FreeCAD.

Code: Select all

import OpenSCADCommands, OpenSCAD2Dgeom, OpenSCADFeatures
User avatar
chennes
Veteran
Posts: 3908
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: OpenSCAD or OCC.Core ? for low level manupulating?

Post by chennes »

I don't know why Defeaturing uses anything from OpenSCAD, but there is nothing "low-level" about how the OpenSCAD WB works, it's a Python WB that just calls normal FreeCAD stuff, plus also can communicate with an external OpenSCAD executable to do language processing. The real purpose of the OpenSCAD workbench is to provide support for calling the OpenSCAD executable from FreeCAD, for those cases where someone might prefer to write OpenSCAD code instead of Python. In my view its best use is simply as an importer of OpenSCAD code. Which is all a long-winded way of saying that the answer to your question is "use OpenCASCADE" :D .
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
mariwan
Posts: 469
Joined: Wed Jan 06, 2021 2:00 pm

Re: [SOLVED]OpenSCAD or OCC.Core ? for low level manupulating?

Post by mariwan »

Thanks for all of you.. I got the answer
User avatar
onekk
Veteran
Posts: 6205
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: [SOLVED]OpenSCAD or OCC.Core ? for low level manupulating?

Post by onekk »

OCC is PythonOCC that is a different way to access OCCT engine.

Code: Select all

import OCC
>>> print(dir(OCC))
['PYTHONOCC_VERSION_DEVEL', 'PYTHONOCC_VERSION_MAJOR', 'PYTHONOCC_VERSION_MINOR', 'PYTHONOCC_VERSION_PATCH', 'VERSION', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__']

Code: Select all

print(help(OCC.Core))
Help on package OCC.Core in OCC:

NAME
    OCC.Core

PACKAGE CONTENTS
    AIS
    Adaptor2d
    Adaptor3d
    Addons
    AdvApp2Var
    AdvApprox
    AppBlend
    AppCont
    AppDef
    AppParCurves
    AppStd
    AppStdL
    Approx
    ApproxInt
    Aspect
    BOPAlgo
    BOPDS
    BOPTools
    BRep
    BRepAdaptor
    BRepAlgo
    BRepAlgoAPI
    BRepApprox
    BRepBlend
    BRepBndLib
    BRepBuilderAPI
    BRepCheck
    BRepClass
    BRepClass3d
    BRepExtrema
    BRepFeat
    BRepFill
    BRepFilletAPI
    BRepGProp
    BRepIntCurveSurface
    BRepLProp
    BRepLib
    BRepMAT2d
    BRepMesh
    BRepMeshData
    BRepOffset
    BRepOffsetAPI
    BRepPrim
    BRepPrimAPI
    BRepProj
    BRepSweep
    BRepTools
    BRepTopAdaptor
    BSplCLib
    BSplSLib
    BVH
    BiTgte
    BinDrivers
    BinLDrivers
    BinMDF
    BinMDataStd
    BinMDataXtd
    BinMDocStd
    BinMFunction
    BinMNaming
    BinMXCAFDoc
    BinObjMgt
    BinTObjDrivers
    BinTools
    BinXCAFDrivers
    Bisector
    Blend
    BlendFunc
    Bnd
    BndLib
    CDF
    CDM
    CPnts
    CSLib
    ChFi2d
    ChFi3d
    ChFiDS
    ChFiKPart
    Contap
    Convert
    Draft
    DsgPrs
    ElCLib
    ElSLib
    Exception
    Expr
    ExprIntrp
    Extrema
    FEmTool
    FSD
    FairCurve
    FilletSurf
    GC
    GCE2d
    GCPnts
    GProp
    GccAna
    GccEnt
    GccInt
    Geom
    Geom2d
    Geom2dAPI
    Geom2dAdaptor
    Geom2dConvert
    Geom2dEvaluator
    Geom2dGcc
    Geom2dHatch
    Geom2dInt
    Geom2dLProp
    GeomAPI
    GeomAbs
    GeomAdaptor
    GeomConvert
    GeomEvaluator
    GeomFill
    GeomInt
    GeomLProp
    GeomLib
    GeomPlate
    GeomProjLib
    GeomToStep
    GeomTools
    Graphic3d
    HLRAlgo
    HLRAppli
    HLRBRep
    HLRTopoBRep
    Hatch
    HatchGen
    Hermit
    IFSelect
    IGESCAFControl
    IGESControl
    IGESData
    IGESToBRep
    IMeshData
    IMeshTools
    Image
    IntAna
    IntAna2d
    IntCurve
    IntCurveSurface
    IntCurvesFace
    IntImp
    IntImpParGen
    IntPatch
    IntPolyh
    IntRes2d
    IntStart
    IntSurf
    IntTools
    IntWalk
    Interface
    InterfaceGraphic
    Intf
    Intrv
    LDOM
    LProp
    LProp3d
    Law
    LocOpe
    LocalAnalysis
    MAT
    MAT2d
    MMgt
    Media
    MeshVS
    Message
    MoniTool
    NCollection
    NLPlate
    OSD
    PCDM
    PLib
    Plate
    Plugin
    Poly
    Precision
    ProjLib
    Prs3d
    PrsDim
    PrsMgr
    Quantity
    RWGltf
    RWMesh
    RWObj
    RWStepAP203
    RWStepAP214
    RWStepAP242
    RWStepBasic
    RWStepDimTol
    RWStepElement
    RWStepFEA
    RWStepGeom
    RWStepRepr
    RWStepShape
    RWStepVisual
    RWStl
    Resource
    STEPCAFControl
    STEPConstruct
    STEPControl
    STEPEdit
    STEPSelections
    Select3D
    SelectBasics
    SelectMgr
    ShapeAlgo
    ShapeAnalysis
    ShapeBuild
    ShapeConstruct
    ShapeCustom
    ShapeExtend
    ShapeFix
    ShapeProcess
    ShapeProcessAPI
    ShapeUpgrade
    Standard
    StdFail
    StdPrs
    StdSelect
    StepAP203
    StepAP209
    StepAP214
    StepAP242
    StepBasic
    StepData
    StepDimTol
    StepElement
    StepFEA
    StepGeom
    StepRepr
    StepShape
    StepToGeom
    StepToTopoDS
    StepVisual
    StlAPI
    Storage
    Sweep
    TColGeom
    TColGeom2d
    TColQuantity
    TColStd
    TColgp
    TCollection
    TDF
    TDataStd
    TDataXtd
    TDocStd
    TFunction
    TNaming
    TObj
    TPrsStd
    TShort
    Tesselator
    TopAbs
    TopBas
    TopClass
    TopCnx
    TopExp
    TopLoc
    TopOpeBRep
    TopOpeBRepBuild
    TopOpeBRepDS
    TopOpeBRepTool
    TopTools
    TopTrans
    TopoDS
    TopoDSToStep
    Transfer
    TransferBRep
    UTL
    Units
    UnitsAPI
    V3d
    Visualization
    Vrml
    VrmlAPI
    VrmlConverter
    VrmlData
 
The list above, is a reduced output of the command.

It is in fact PythonOCC see: https://wiki.freecadweb.org/PythonOCC

You could run this code in FreeCAD and the pointcloud will work, (other two items don't work, because they rely on files that are not in OCC bundled with FreeCAD APPImage, or because OCC directory is not properly load in the FreeCAD Path)

https://github.com/tpaviot/pythonocc-de ... t_cloud.py

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
Post Reply