Геометрическое моделирование

Подписаться на эту рубрику по RSS

Заметки на геометрическую тематику.

Build a prismatic block in OpenCascade

The following procedure builds a solid trapezoid block in the Draw console of OpenCascade:

proc buildBlock {resname L0 B0 a1Deg a2Deg height} {
  global $resname
  
  set Pi 3.1415926535897931
  
  # Design variables.
  set a1 [expr $a1Deg.*$Pi/180.]
  set a2 [expr $a2Deg.*$Pi/180.]
  set V1x [expr -$L0/2 - tan($a1)*$B0/2]
  set V1y 0
  set V2x [expr $L0/2 + tan($a2)*$B0/2]
  set V2y 0
  set V3x [expr $L0/2 - tan($a2)*$B0/2]
  set V3y $B0
  set V4x [expr -$L0/2 + tan($a1)*$B0/2]
  set V4y $B0
  
  # Build topology.
  vertex V1 $V1x $V1y 0.
  vertex V2 $V2x $V2y 0.
  vertex V3 $V3x $V3y 0.
  vertex V4 $V4x $V4y 0.
  #
  edge e1 V2 V1
  edge e2 V1 V4
  edge e3 V4 V3
  edge e4 V3 V2
  wire w e1 e2 e3 e4
  mkplane f w
  #
  prism $resname f 0 0 $height
}
  
# source create-block-01.tcl
# buildBlock b 130 60 20 45 30
# top; fit
Parametric block in OpenCascade.

This Tcl procedure defines a parametric modeling workflow. By "parametric" here I mean that the modeling algorithm exposes design parameters, therefore its logic encodes some design intent. This approach to parametric modeling is simple and stupid. It is opposed to constraint-driven design that traditionally employs geometric constraint solvers, such as PlaneGCS or SolveSpace (there is no in-house solver in OpenCascade). For example, the parametric sketches in FreeCAD and CAD Builder are based on the PlaneGCS solver developed by people from the FreeCAD community.

Blocks composed to a simplistic model of a city.

Although simple, this technique of modeling has a practical value. For example, one can easily compose a simulation model of a city environment aimed at subsequent wind comfort simulation (like in the application of Ingrid Cloud). The computational mesh can be generated with the help of a shrink wrapping.

Scaled jacobian scalar field for the wrapped simulation model.