Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Anonymous
2368 Views, 7 Replies

iLogic rotate Part

I've been using iLogic to create a Shrinkwrap of an assembly. The problem I'm having is it resets the current view. I need to rotate the Part (Which is a new Part Document) 90° to the right.

 

I found and have been trying a bit with this:

 

  Const PI = 3.14159265358979
  
  Dim d As Inventor.PartDocument
  d = ThisApplication.ActiveDocument
 

  Dim a As WorkAxis
  
  a = d.ComponentDefinition.WorkAxes(1)
 
  Dim o As Inventor.ComponentDefinition
  o = d.ComponentDefinition


  Dim t As TransientGeometry
  t = ThisApplication.TransientGeometry
     
  Dim l As Line
  l = a.Line
  
  Dim mRot As Matrix
  mRot = t.CreateMatrix()
  ' PI / 2 => 90 deg
  mRot.SetToRotation(PI / 2, l.Direction.AsVector(), l.RootPoint)
  
  Dim m As Matrix
  m = o.Transformation

  MessageBox.Show("Message", "Title")
  m.PreMultiplyBy(mRot)
  
  o.Transformation = m