Reply

Use of ConvToSMs

[ Edited ]

 

 

Hello everybody !!

 

I'm just trying to use the ConvToSMs.add method...

The code below is crashing on the last line. (System.NullReferenceException)

I just can't find a way to convert a solid dumb model to sheetmetal using this method. Of course, the Solid Edge tool is working with my test part when choosing the largest face.

Any help is welcome ! Thenks a lot and see you !

 

        Dim objapp As SolidEdgeFramework.Application

        objApp = GetObject(,"SolidEdge.Application")

 

        Dim obj_psm As SolidEdgePart.SheetMetalDocument

        obj_psm = objapp.ActiveDocument

 

        Dim obj_model As SolidEdgePart.Model

        obj_model = obj_psm.Models.Item(1)

 

 

        Dim obj_Body As SolidEdgeGeometry.Body

        obj_body = obj_model.Body

        Dim obj_faces as SolidEdgeGeometry.Faces

        obj_faces = obj_body.Faces(SolidEdgeGeometry.FeatureTopologyQueryTypeConstants.igQueryPlane)

 

        Dim biggest_face As SolidEdgeGeometry.Face

        Dim face As SolidEdgeGeometry.Face       

        For Each face In obj_faces

            If biggest_face Is Nothing Then

                    biggest_face = face         

            End If

            If face.Area > biggest_face.Area Then

                biggest_face = face

            End If

        Next

 

        Dim obj_convtosm As SolidEdgePart.ConvToSM

        Debug.Print(biggest_face.Area)

        obj_convtosm = obj_model.ConvToSMs.add(RefFace:=biggest_face)

 

Posted by: Anthony PONCEOT
Post date: 11/17/2008 8:13:18 AM