×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Problem with the function booleanFeature.add with Visual Basic

Problem with the function booleanFeature.add with Visual Basic

Problem with the function booleanFeature.add with Visual Basic

(OP)
Hello everybody

I try to do a substract between two solids.
I created a DocumentPart.
I copy two parts on this new document.
the first created a model in objDoc.Models.
the second add a Item in objDoc.Constructions.CopyConstructions
and add a item in objDoc.Models(1).Features

So, I process this function :
objDoc.Models.Item(1).BooleanFeatures.Add with goods parameters but it fails!

I don't understand. Does somebody can help me?

thanks a lot

Xavier FAURE

CODE

Module ModuleVolume

Sub Main()
'Declare the program variables.
Dim objApp As Object = Nothing
Dim objDocs As Object = Nothing

'Turn on error handling.
On Error Resume Next

'Connect to a running instance of Solid Edge.
objApp = GetObject(, "SolidEdge.Application")
If objApp Is Nothing Then
'Error message
MsgBox("The Application is closed. The program is going to open it.")
'Start Solid Edge.
objApp = CreateObject("SolidEdge.Application")
End If

'Turn off error handling.
On Error GoTo 0

'Make the application window visible.
objApp.Visible = True

'Access the Documents collection.
objDocs = objApp.Documents

Dim objDoc As Object

'Find out if any documents are open.
If objDocs.Count = 0 Then
'Add an Part document.
objDoc = objDocs.Add("SolidEdge.PartDocument")
Else
'Access the currently open document.
'MsgBox("Connection of part which is opened")
objDoc = objApp.ActiveDocument
End If

Dim objModel As SolidEdgePart.Model = objDoc.Models(1)
MsgBox("Number of shells ( in Models(1).Body ) : " + objModel.Body.Shells.Count.ToString)
MsgBox("Number of features : " + objModel.Features.Count.ToString)
Dim objConstructions As SolidEdgePart.Constructions = objDoc.Constructions
MsgBox("Number of constuctions : " + objConstructions.Count.ToString)
Dim objCopyConstructions As SolidEdgePart.CopyConstructions = objConstructions.CopyConstructions
MsgBox("Number of CopyConstructions : " + objCopyConstructions.Count.ToString)

Dim objBooleanFeatures As SolidEdgePart.BooleanFeatures = objDoc.Models.Item(1).BooleanFeatures

'The number of solid to do the boolean opertation
Dim NumberOfTools As Integer = 1
'A array which contains these solids
Dim Tools() As Object = {objConstructions.Item(1).Body}
'A member of the BooleanFeatureConstants constant set that specifies the type of Boolean operation to perform.
Dim Operation As SolidEdgePart.BooleanFeatureConstants = SolidEdgePart.BooleanFeatureConstants.seBooleanSubtract

MsgBox("Clic on Ok to process the function")

'Process the boolean fonction
objBooleanFeatures.Add(NumberOfTools, Tools, Operation)

MsgBox("It's Ok")

End Sub

End Module

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources