Problem Creating Prism

Hi, I'm having trouble creating a Prism with BRepPrimAPI_MakePrism(TopoDS_Shape,gp_Vec)

I've created a base face out of BRepBuilderAPI_MakePolygon then adding points to it. This face is a triangle and after adding all the points I close() it.

Next I made a gp_Vec out of two gp_Pnt points.
when I do this:
TopoDS_Solid myFixed = BRepPrimAPI_MakePrism(baseFace,prismVector);

I get this error in MSVC .Net

binary '=' no operator found which takes a right-hand operand of type 'BRepPrimAPI_MakePrism'

This seems to work fine with other BRepPrimAPI types such as MakeBox and MakeCylinder... except makePrism. Any help would be greatly appreciated! Here's the code:

//Create base face from user input
//Create vertices for triangle
//Where X(), Y(), Z() are just coordinates
BRepBuilderAPI_MakePolygon baseFace;
baseFace.Add( gp_Pnt( m_pntPoint.X() + m_vlsFixed.width/2, m_pntPoint.Y() - m_vlsFixed.length/2, m_pntPoint.Z()) );
baseFace.Add( gp_Pnt( m_pntPoint.X() - m_vlsFixed.width/2, m_pntPoint.Y() - m_vlsFixed.length/2, m_pntPoint.Z()) );
baseFace.Add( gp_Pnt( m_pntPoint.X(), m_pntPoint.Y() + m_vlsFixed.length/2, m_pntPoint.Z() );
baseFace.Close();

//Create vector using 2 points
gp_Pnt p1(m_pntPoint.X(),m_pntPoint.Y(),m_pntPoint.Z());
gp_Pnt p2(m_pntPoint.X(),m_pntPoint.Y(),m_vlsFixed.height);
gp_Vec prismVector(p1,p2);
TopoDS_Solid myFixed;
myFixed = BRepPrimAPI_MakePrism(baseFace,prismVector);

Thanks in advance!

Stephane Routelous's picture

Hi,

try
TopoDS_Solid myFixed = BRepPrimAPI_MakePrism(baseFace,prismVector).Shape();

HTH

Herbs's picture

Hi Stephane,

Thanks for your reply, shape seems to work in creatin a TopoDS_Shape from the prism but now I still have a problem of changing TopoDS_Shape into a TopoDS_Solid. Any suggestions?

Thanks

Herbs's picture

Hi,

Just to elaborate or rephrase my problem. I'm trying to create a solid prism that I can do boolean operations with other shapes. I managed to change everything to shape and it worked, but the shape still needs to be a solid.

So I think in other words, my question will be:
What is the easiest way to create a solid triangular prism?

Thanks.

Robert Boehne's picture

Hi,

try
TopoDS_Solid myFixed = TopoDS::Solid(BRepPrimAPI_MakePrism(baseFace,prismVector).Shape());

HTH,

Robert