Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

macro to rotate points about the z axis onto the zx plane

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
278 Views, 2 Replies

macro to rotate points about the z axis onto the zx plane

I'm trying to figure out a way to rotate points about the Z axis onto the ZX plane.  These points are generated on a CMM and imported into inventor via an .iges file.  The part is round, so the z axis is center of rotation.  I would like to write a macro that I can execute every time I import an .iges file.  I have attached a file of the points and screenshot.  I'm trying to rotate the pink points to the zx plane to close the profile on the yellow points.

 

thanks 

2 REPLIES 2
Message 2 of 3
WCrihfield
in reply to: Anonymous

Here is a fairly simple iLogic rule I just created that seemed to work OK to accomplish this task on the sample file provided.  There must have been a ton of points to move, because it seemed like it took at least 30 seconds to complete the task.  If you need this in VBA instead of iLogic, just let me know.

Dim oPDoc As PartDocument = ThisApplication.ActiveDocument
Dim oTrans As Transaction = ThisApplication.TransactionManager.StartTransaction(oPDoc, "Rotate Points")
Dim oPDef As PartComponentDefinition = oPDoc.ComponentDefinition
Dim oMea As MeasureTools = ThisApplication.MeasureTools
Dim oZAxis As WorkAxis = oPDef.WorkAxes.Item("Z Axis")
Dim oXZPlane As WorkPlane = oPDef.WorkPlanes.Item("XZ Plane")
Dim o3DSketch As Sketch3D = oPDef.Sketches3D.Item(1)
For Each oPt3d As SketchPoint3D In o3DSketch.SketchPoints3D
	If oPt3d.Geometry.Y = 0 Then Continue For
	'measure distance point is from Z-Axis
	'Dim oDist As Double = oMea.GetMinimumDistance(oZAxis, oPt3d, InferredTypeEnum.kInferredLine, InferredTypeEnum.kInferredPoint)
	Dim oDist As Double = oMea.GetMinimumDistance(oZAxis, oPt3d)
	Dim oNewPoint As Point = ThisApplication.TransientGeometry.CreatePoint(oDist, 0, oPt3d.Geometry.Z)
	oPt3d.MoveTo(oNewPoint)
Next
oTrans.End
oPDoc.Update

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.

If you want and have time, I would appreciate your Vote(s) for My IDEAS :light_bulb: or you can Explore My CONTRIBUTIONS

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 3
Anonymous
in reply to: Anonymous

@WCrihfield

 

Thanks for your help.  This rule worked and your right, it takes a little bit of time.  Way better than what I was having to do.  We have another macro that I can run to reduce the number of points. I tried this ilogic rule on a couple of parts with success.

Thanks again

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report