- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello @Anonymous
I may not understand what you want exactly, but you can only reorient a sub-assembly or part within an assembly.
A part has no orientation / matrix..
@Anonymous schrieb:
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 m As Matrix m = o.Transformation ...
The red line should not be possible.
Can you make a few screenshots or a screencast to explain us your request in detail?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Thanks for your reply. I'm trying to rotate the part 90 degrees. In the first image the part is shrinkwrapped, when it's shrinkwrapped it changes the current view. The second one shows how the current view is supposed to be.
I'm trying to do this by iLogic because of automation reasons.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Basically you want to reorient the solid, right? I've never realized that before. Unfortunately I do not know how this should work or if it is even that easy to do.
But the problem you will have is the following.
Suppose you put the part into many assemblies. Later you change the orientation of the solid body within the IPT.
Then none of your previously created assemblies will fit because the part is suddenly aligned differently.
It would be better to reorient the part within the assembly in which it is placed.
Would that be a possible solution for you?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Take a look on the solution of this german post.
https://forums.autodesk.com/t5/inventor-deutsch/problem-mit-putmatrixdata/m-p/9315531#M17696
You can run the iLogic to rotate a selected component within an assembly by entering the angle values.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Ah thanks! I'll tingle around with it later. My part isn't an assembly though, it's a simple part file. Any idea on how to select the component?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Since you are dealing with a Part, perhaps something like the following would work for you.
Dim oDoc As PartDocument = ThisApplication.ActiveDocument Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition 'Dim oBody As SurfaceBody = oDef.SurfaceBodies.Item(1) Dim oBody As SurfaceBody = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartBodyFilter, "Select a Part Body.") Dim oMoveFeatDef As MoveDefinition = oDef.Features.MoveFeatures.CreateMoveDefinition(oBody) Dim oAxis As WorkAxis = oDef.WorkAxes.Item(1) oMoveFeatDef.AddRotateAboutAxis(oAxis, False, "90 deg") Dim oMoveFeat As MoveFeature = oDef.Features.MoveFeatures.Add(oMoveFeatDef) oMoveFeat.Name = "Rotate " & oBody.Name & " About " & oAxis.Name & " By 90 degrees"
It uses the MoveBody command, but instead of a linear move, it uses the not-so-obvious option (normally hidden within the drop-down) of rotation. This assumes it is all one body, and not several solid bodies.
Wesley Crihfield
(Not an Autodesk Employee)