Creating a plane by Plane & Point

Creating a plane by Plane & Point

llorden4
Collaborator Collaborator
1,106 Views
5 Replies
Message 1 of 6

Creating a plane by Plane & Point

llorden4
Collaborator
Collaborator

I'm not seeing what's giving me an error when attempting to create this plane in an ".ipt" part file.

PlanePoint(1) = oTG.CreatePoint(1, 1, 0)
oWorkPlane = oCompDef.WorkPlanes.AddByPlaneAndPoint(oCompDef.WorkPlanes.Item("Base Sketch Plane"), PlanePoint(1), False)
 oWorkPlane.Name = "Tip Sketch Plane"
 oWorkPlane.Visible = False
 oWorkPlane.AutoResize = False

 I can't share the whole of the code due to non-disclosure agreements, but this short snippet should get the point across.  I've confirmed that the "Base Sketch Plane" is spelled correctly and exists.  PlanePoint(1) is a random point in space I picked that does not contact the "Base Sketch Plane" I am referencing.  PlanePoint(#) is predefined as a "Point" (not shown here).

 

llorden4_0-1641320094556.png

 

Line 410 would be...

oWorkPlane = oCompDef.WorkPlanes.AddByPlaneAndPoint(oCompDef.WorkPlanes.Item("Base Sketch Plane"), PlanePoint(1), False)

 

Autodesk Inventor Certified Professional
0 Likes
Accepted solutions (1)
1,107 Views
5 Replies
Replies (5)
Message 2 of 6

WCrihfield
Mentor
Mentor

So...somewhere above that code you created an array of Point objects, something like this right?

Dim PlanePoint(2) As Point

...then your first line shown is setting a value to one of those array slots, right?  That array object/variable wasn't created in a parallel block of code or something like that, instead of at the same level or above was it?  Also, just another rather obvious check...Item 1 is within the available range of slots in the array, right?  For instance the array wasn't created like Dim PlanePoints(0) As Point, where it would only have Item(0), and not an Item(1), or the array wasn't created like Dim PlanePoints(2 To 4) As Point, or something like that, right?

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 6

llorden4
Collaborator
Collaborator

Correct, the actual declaration is Dim PlanePoints(3) as Point.
I had been using this same point successfully to develop a Fixed 3 point plane at the very start of the code, not nested within an If statement, I know where you're headed here. My lofted flange is failing so I thought perhaps my floating point values for point creation are making the offset plane not exactly parallel so this is my attempt to resolve that. I have very high confidence in the point.
This PlanePoint(1) is the intended origin point for the new plane, 2 and 3 will no longer be used once I get this working.

Autodesk Inventor Certified Professional
0 Likes
Message 4 of 6

llorden4
Collaborator
Collaborator

I gave up trying to get this to work, calculated the distance between the points and used a .PlaneAndOffset option instead.

Autodesk Inventor Certified Professional
0 Likes
Message 5 of 6

JelteDeJong
Mentor
Mentor
Accepted solution

Just for further refrence (or if you wanna give it a go anyway). The problem is that you are trying to use a Point-object for creating the plane. That is not a valid input.

JelteDeJong_0-1641412622213.png

The easiest way I could think of was creating a sketch and a SketchPoint. Have a look at this iLogic rule:

Dim doc As PartDocument = ThisDoc.Document
Dim oCompDef As PartComponentDefinition = doc.ComponentDefinition
Dim oTG = ThisApplication.TransientGeometry

Dim PlanePoint As Point = oTG.CreatePoint(1, 1, 0) ' this is your orginal point

Dim sketch3d = oCompDef.Sketches3D.Add()
sketch3d.Visible = False
Dim sketchPoint As SketchPoint3D = sketch3d.SketchPoints3D.Add(PlanePoint)

Dim oWorkPlane = oCompDef.WorkPlanes.AddByPlaneAndPoint(oCompDef.WorkPlanes.Item("Base Sketch Plane"), sketchPoint, False)
oWorkPlane.Name = "Tip Sketch Plane"
oWorkPlane.Visible = False
oWorkPlane.AutoResize = False

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes
Message 6 of 6

llorden4
Collaborator
Collaborator

I think you said that backwards, but I got your point.  I was attempting to use a "Point" and not a WorkPoint that is an "Object".  Yep, makes perfect sense now.  Thanks!

Autodesk Inventor Certified Professional
0 Likes