add part like drag from part library?

 

How to add a part to assembly enviroment,  just like drag a part file to assembly enviroment? Active the assembly command after draged part to assembly enviroment?

 

Posted by: assassin 007
Post date: 7/5/2009 11:01:11 PM

4 REPLIES

RE: add part like drag from part library?

 

Hi,

Search AddByFilename in the SolidEdge Programming Help.

Regards

Massimo

' Note: This Visual Basic 6 example is for reference only as it has not been converted to Visual Basic .NET.

' Occurrences.AddByFilename

 

Private Sub Form_Load()

    Dim objApp As SolidEdgeFramework.Application

    Dim objDoc As SolidEdgeAssembly.AssemblyDocument

    Dim objParts As SolidEdgeAssembly.Occurrences

    Const TESTFILE = "T:\vbtests\testcases\chead.par"

    ' Report errors

    Const PI = 3.14159265358979

    ' Create/get the application with specific settings

    On Error Resume Next

    Set objApp = GetObject(, "SolidEdge.Application")

    If Err Then

        Err.Clear

        Set objApp = CreateObject("SolidEdge.Application")

        Set objDoc = objApp.Documents.Add("SolidEdge.AssemblyDocument")

        objApp.Visible = True

    Else

        Set objDoc = objApp.ActiveDocument

    End If

    ' adding a part document from a file to the assembly document

    Set objParts = objDoc.Occurrences

    Call objParts.AddByFilename(OccurrenceFileName:=TESTFILE)

    ' USER DISPLAY

    ' Release objects

    Set objApp = Nothing

    Set objDoc = Nothing

    Set objParts = Nothing

End Sub

 

Posted by: Massimo Magris
Post date: 7/5/2009 11:11:42 PM

RE: add part like drag from part library?

Hi, Massimo, thanks! But the result is that the part is fixed. I want that user can set part 3d relationships after added the part.

 

Posted by: assassin 007
Post date: 7/6/2009 5:32:25 PM

RE: add part like drag from part library?

 

Hi,

so just create a VB form with a kind of "explorer".

When user drag & drop a file from the form to SolidEdge with an assembly open,

SolidEdge automatically start the command and ask for relationship.

Regards

Massimo

 

Posted by: Massimo Magris
Post date: 7/6/2009 7:24:34 PM

RE: add part like drag from part library?

 

Hi,

This is an old VB6 example i did for someone else.

It simulates the command "Place Part". The only thing you must provide is the filename.

It uses the "OnPlacePartUI" event.

Well, just try it. Regards,

Julian

(Back from my only 1 week holidays)

 

Posted by: Julian Guillo
Post date: 7/7/2009 6:48:01 AM