inserting a plane at the current view point.

Is there a way to extract the coordinates of the current view point in order to insert a reference plane?

For example I need to input a plane at a skewed angle. (from the standard 3 orientation)

Take any part and use the view rotate function to get the part into a orientation that is "moldable".

If I record a macro I get stuff that looks like this:

Part.ActiveView().RotateAboutCenter 0, 0.013533 Part.ActiveView().RotateAboutCenter 0, 0.00676651 Part.ActiveView().RotateAboutCenter 0, 0.00676651 Part.ActiveView().RotateAboutCenter -0.00497162, 0 Part.ActiveView().RotateAboutCenter 0, 0.00676651 End Sub

How can I use this to define a plane with 3 points?

Can anybody help me with this?

Reply to
JF
Loading thread data ...

I wrote this one a few months ago becuase I required it.

just paste this into an empty macro

Sub main() 'Written by Corey Scheich 'Creates a plane Parallel with the current view rotation 'through the origin of the part

Dim swApp As SldWorks.SldWorks Dim Model As SldWorks.ModelDoc2 Dim ThisView As SldWorks.ModelView Dim ViewTransform As SldWorks.MathTransform Dim MathUtil As SldWorks.MathUtility Dim Point1 As SldWorks.MathPoint Dim Point2 As SldWorks.MathPoint Dim Point3 As SldWorks.MathPoint Dim dPoint(2) As Double Dim vPoint As Variant Dim NewPlane As SldWorks.refPlane

Set swApp = Application.SldWorks Set Model = swApp.ActiveDoc Set ThisView = Model.ActiveView Set MathUtil = swApp.GetMathUtility

dPoint(0) = 0 dPoint(1) = 0 dPoint(2) = 0

vPoint = dPoint

Set Point1 = MathUtil.CreatePoint((vPoint)) Point1.ArrayData = vPoint dPoint(0) = 1 dPoint(1) = 0 dPoint(2) = 0

vPoint = dPoint

Set Point2 = MathUtil.CreatePoint((vPoint))

dPoint(0) = 0 dPoint(1) = 1 dPoint(2) = 0

vPoint = dPoint

Set Point3 = MathUtil.CreatePoint((vPoint))

Set ViewTransform = ThisView.Orientation3 'change from (model to view) to (view to model) Set ViewTransform = ViewTransform.Inverse

'transform the points from View to Model Set Point1 = Point1.MultiplyTransform(ViewTransform) Set Point2 = Point2.MultiplyTransform(ViewTransform) Set Point3 = Point3.MultiplyTransform(ViewTransform)

'Create a plane through the points Set NewPlane = Model.CreatePlaneFixed2( _ Point1.ArrayData, _ Point2.ArrayData, _ Point3.ArrayData, _ True) Model.UnBlankRefGeom

End Sub

Reply to
CS

Cool!

that works great!

Reply to
JF

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.