Getting surface of a cylinder

Forum for reporting problems
Post Reply
Eugine Halep
Posts: 0
Joined: Fri Jul 19, 2019 12:57 am

Getting surface of a cylinder

Post by Eugine Halep »

Hi
I am trying to access surface of a cylinder like

Code: Select all

IStdShape_DG stdshape = model as IStdShape_DG;
IEntity_DG myCyl = stdshape.Cylinder(_R, _R, _h);
IBSplineSurface_DG surf = myCyl as IBSplineSurface_DG; 
I get an exception on the last line. what is wrong here?
Thank you

Oleg Skvortsov
Posts: 0
Joined: Sun Feb 23, 2014 6:28 am

Re: Getting surface of a cylinder

Post by Oleg Skvortsov »

Surface belongs to face. You need to get the face first.

Code: Select all

IBRepGeometry_DG brepGeom = myCy.GetGeometry() as IBRepGeometry_DG;
IBRepShape_DG solid = brepGeom.GetShape() as IBRepSolid_DG;
IBRepShell_DG shell = solid.GetOuterShell(false);
IBRepFace_DG face = shell.GetFace(indexOfTheFace);
IBSplineSurface_DG surf = face.GetSurface() as IBSplineSurface_DG

Eugine Halep
Posts: 0
Joined: Fri Jul 19, 2019 12:57 am

Re: Getting surface of a cylinder

Post by Eugine Halep »

Thank you, Oleg

Post Reply