linkedin
Q:

How can I apply a semi-transparent appearance to selected parts in an assembly via VBA?

  • himanshu jindal
  • Apr 02, 2026

1 Answers

A:

You can create a VBA macro that applies a semi-transparent appearance (like clear blue) to selected parts in an assembly.

The key is to:

  • Loop through the SelectSet in the active assembly.
  • Confirm each item is a ComponentOccurrence.
  • Apply a custom or predefined appearance with transparency.
  • Manish Solanki
  • Apr 03, 2026

0 0

Related Question and Answers

Q:

A:

HANDBRAKE is one of the most popular and free video conversion tools.

It is open source, easy to use, and works on Windows and Mac.

  • Mir Hussain
  • Mar 25, 2026

A:

If the fx parameter is derived from another editable parameter, you can:

  • Use VBA to change the base parameter.
  • The fx parameter will update automatically.

Dim oPartDoc As PartDocument
Set oPartDoc = ThisApplication.ActiveDocument

Dim oParams As Parameters
Set oParams = oPartDoc.ComponentDefinition.Parameters

oParams.Item("BaseLength").Value = 10 ' This affects fx parameters that depend on BaseLength
  • Terence Dasshna
  • Apr 03, 2026

A:

Yes, Nishan-it is possible to build an Inventor assembly file (.iam) offline, without launching the Inventor UI, using the ApprenticeServer API.

You can prepare a blank .iam template and use Apprentice to:

  1. Open the template
  2. Insert existing .ipt files as component occurrences
  3. Save the modified .iam

Here’s a simplified VB.NET snippet using Apprentice:


Dim apprenticeApp As New Inventor.ApprenticeServerComponent
Dim asmDoc As ApprenticeServerDocument = apprenticeApp.Open("C:\Templates\BlankAssembly.iam")

Dim partDoc As ApprenticeServerDocument = apprenticeApp.Open("C:\Parts\MyPart.ipt")
Dim asmCompDef As ApprenticeComponentDefinition = asmDoc.ComponentDefinition

' This part is tricky — Apprentice does not expose AddOccurrence directly
' You'd need Inventor API for precise placement and constraints

asmDoc.SaveAs("C:\Assemblies\BuiltOffline.iam", False)
  • Ram Upadhyay
  • Apr 01, 2026

A:

Here’s how to make it work more reliably:

  1. Initialize Apprentice Properly

    Make sure Apprentice is initialized before loading the control:

    
    Dim appServer As Inventor.ApprenticeServerComponent = New Inventor.ApprenticeServerComponent()
            
  2. Use Static Viewing Instead of Interactive Tools

    Avoid using toolbar buttons like Rotate or Zoom directly. Instead, control the view programmatically:

    
    Dim viewCtrl As InventorViewControl = Me.InventorViewControl1
    viewCtrl.ViewOrientation = Inventor.ViewOrientationEnum.kIsoTopRightView
    viewCtrl.Fit()
            
  3. Disable Toolbar or Customize It

    If Rotate causes crashes, disable or hide it:

    
    viewCtrl.ToolbarVisible = False
            

    Or selectively enable safe tools:

    
    viewCtrl.ToolbarVisible = True
    viewCtrl.EnableZoom = True
    viewCtrl.EnablePan = True
    viewCtrl.EnableRotate = False ' Disable problematic tool
            
  4. Use Try-Catch Around View Manipulation

    Protect your code from runtime exceptions:

    
    Try
        viewCtrl.RotateView(30, 0) ' Example: rotate 30 degrees around X
    Catch ex As Exception
        MessageBox.Show("Rotate failed: " & ex.Message)
    End Try
            
  5. Ensure Graphics Compatibility

    Make sure your system supports DirectX 11 and your form has proper DPI and scaling settings. Some crashes stem from graphics context mismatches.

  • Dhairya
  • Apr 01, 2026

A:

Get Position and Orientation of a Work Plane

Use the WorkPlane.GetPosition method to extract the origin and orientation vectors:


Dim oPartDoc As PartDocument = ThisApplication.ActiveDocument
Dim oCompDef As PartComponentDefinition = oPartDoc.ComponentDefinition
Dim oWorkPlane As WorkPlane = oCompDef.WorkPlanes.Item(1) ' or any specific work plane

Dim origin As Point
Dim xAxis As UnitVector
Dim yAxis As UnitVector

oWorkPlane.GetPosition(origin, xAxis, yAxis)

MsgBox("Origin: " & origin.X & ", " & origin.Y & ", " & origin.Z)
MsgBox("X Axis: " & xAxis.X & ", " & xAxis.Y & ", " & xAxis.Z)
MsgBox("Y Axis: " & yAxis.X & ", " & yAxis.Y & ", " & yAxis.Z)
  • Bekele Terefe
  • Apr 02, 2026

Find the Best CAD Software

Explore all products with features, pricing, reviews and more

View All Software
img

Have a Question?

Get answered by real users or software experts

Ask Question

Help the community

Be the First to Answer these questions

I have set the SelectionFilter to "Parts" selected a part. In my view I want to have the FullFileName of that selected part. Why is this not possible?

Write Answer

I have 2 separate Add-Ins created for Inventor. When I compile them. One of the Add-Ins always has the same ClsID. The other Add-In gives me a new ClsID every time I compile it. Any idea why this is happening?

Write Answer

I would like to emulate the selection process we see when using the distance and angle chamfer command, pick a face and then an edge attached to that face. Is it possible, what do I need to look at?

Write Answer

I need to add a custom property field, BALLOON NO, to about 250 files. Where do I start if I want to create a program to utilize iBatchrun to run through these files?

Write Answer

Still got Questions on your mind?

Get answered by real users or software experts

Disclaimer

Techjockey’s software industry experts offer advice for educational and informational purposes only. A category or product query or issue posted, created, or compiled by Techjockey is not meant to replace your independent judgment.

Software icon representing 20,000+ Software Listed 20,000+ Software Listed

Price tag icon for best price guarantee Best Price Guaranteed

Expert consultation icon Free Expert Consultation

Happy customer icon representing 2 million+ customers 2M+ Happy Customers