@sls1005 thanks a lot for that.

But for some reason is failing. I got:
    
    
    ...
    proc dcast*[T](this: Handle[auto] ):Handle[T] {.cdecl, importcpp: 
"\'0::DownCast(@)".}
    ...
    
    
    Run

and
    
    
    import occt
    
    var aPnt1: Handle[Geom_Point]
    var aPnt2, aPnt3: Handle[Geom_CartesianPoint]
    
    aPnt2 = newHandle( cnew newGeomCartesianPoint(1.0,2.0,3.0) ) #
    aPnt1 = newHandle( cast[ptr Geom_Point](aPnt2.get) )
    
    #echo typeof(aPnt1)  # --> Handle[geom_types.GeomPoint]
    #echo typeof(aPnt3)  # --> Handle[geom_types.GeomCartesianPoint]
    
    aPnt3 = dcast[Geom_CartesianPoint]( aPnt1 )
    
    
    Run

The error I got is:
    
    
    Error: type mismatch: got <void, Handle[geom_types.GeomPoint]>
    but expected one of:
    proc `()`(this: BitPredicate; theLink: BVH_EncodedLink): bool
      first type mismatch at position: 1
      required type for this: BitPredicate
      but expression 'dcast[Geom_CartesianPoint]' is of type: void
    ....
    
    
    Run

Why am I getting `<void, Handle[geom_types.GeomPoint]>` instead of 
`Handle[geom_types.GeomPoint]`? Which it is what I get when I echo 
`typeof(aPnt1)`.

Reply via email to