Hide Table of Contents

Display Temporary Body Example (VBA)

This example shows how to display a temporary body.

 

'-------------------------------------------------

'

' Preconditions: Assembly is open that contains

'                a component called Box-1@Assem.

'

' Postconditions: Temporary body of the component

'                is displayed.

'

'-------------------------------------------------

Option Explicit

 

Sub main()

 

    Dim swApp As SldWorks.SldWorks

    Dim Part As SldWorks.ModelDoc2

    Dim Body As SldWorks.body2

    Dim BodyCopy As SldWorks.body2

    Dim PartDoc As SldWorks.PartDoc

    Dim boolstatus As Boolean

    Dim Component As SldWorks.Component2

    Dim MathUtility As SldWorks.MathUtility

    Dim MathXform As SldWorks.MathTransform

    Dim Xform(15) As Double

    Dim vXform As Variant

    Dim retval As Long

    

    Xform(0) = 1#

    Xform(1) = 0#

    Xform(2) = 0#

    

    Xform(3) = 0#

    Xform(4) = 1#

    Xform(5) = 0#

    

    Xform(6) = 0#

    Xform(7) = 0#

    Xform(8) = 1#

    

    Xform(9) = 0.15

    Xform(10) = 0#

    Xform(11) = 0#

    

    Xform(12) = 1#

    

    Xform(13) = 0#

    Xform(14) = 0#

    Xform(15) = 0#

    

    vXform = Xform

    

    Set swApp = Application.SldWorks

    Set Part = swApp.ActiveDoc

    Set MathUtility = swApp.GetMathUtility

    Set MathXform = MathUtility.CreateTransform(vXform)

    

    boolstatus = Part.Extension.SelectByID2("Box-1@Assem", "COMPONENT", 0, 0, 0, False, 0, Nothing, swSelectOptionDefault)

    Set Component = Part.SelectionManager.GetSelectedObjectsComponent3(1, 0)

    Set Body = Component.GetBody

    Set BodyCopy = Body.Copy

    BodyCopy.ApplyTransform MathXform

    

    retval = BodyCopy.Display3(Component, 255, swTempBodySelectable)

    Debug.Print retval

    

    Stop

 

End Sub



Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

 
*Email:  
Subject:   Feedback on Help Topics
Page:   Display Temporary Body Example (VBA)
*Comment:  
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:



x

We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again
x

Web Help Content Version: API Help (English only) 2010 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.