I have an interesting situation. When I try to add Child based on :IvGeneralNote design (see code below), Intent generates error message (see attached picture).
Child myChild As :IvGeneralNote
point1 = Point(0,0,0)
formattedText = "Bla-bla-bla"
End Child
However, If I add to Child parameter "sheet = Parent", everything is OK.
I don't understand this situation, because parameter "Sheet" is defined in the :IvGeneralNote design like "Parent" by default (see code below):
<%%Category("Inventor"), %%Prompt("Intent Part representing the drawing sheet on which to place the note.")> _
Parameter Rule sheet As Part = Parent
What is happening?
Solved! Go to Solution.
Solved by Chris.Palmatier. Go to Solution.
Are you creating the general note as a child of a sheet? It looks like it's a child of a view, but it should be a child of the sheet if possible (hence the default value of Sheet = Parent).
Thanks for fast reply.
Yes, I'm creating General Notes as a child on the view, because I'm using some entities (center marks) as basic objects for placement point of General Note.
I believe the difference is the context of "Parent".
In the parameter declaration (Parameter Rule sheet As Part = Parent), the context is the part defining the parameter (so Parent of the note).
In the Child definition...
Child myChild As :IvGeneralNote
Sheet = Parent
End Child
...the context is the part defining the child, which is the parent of the note (so Parent of the Parent of the note).
Thanks for reply. This is a little bit misleading.
While technically we allow you to place a general note as a child of other objects, in practice it's best to match Inventor's structure. In Inventor, a general note lives on the sheet, and doesn't reference views or view geometry. Positioning the general note in Intent uses sheet coordinates, so you could use the view's origin easily. If you need to reference view geometry to position the note, look at the methods in %%CommonViewMixin:
'# ------------------------------ '# METHODS '# ------------------------------ ' '# Return a (2d) Point in view space corresponding to the specified Workpoint. ' Method workpointLocation(workpointPart As Part, workpointName As String) As Point Dim modelPoint As Point = model.occurrenceWorkPoint(workpointPart, workpointName, :All) workpointLocation = iv_modelToView(self(), modelPoint) End Method '# Return a (2d) Point in sheet space corresponding to the '# specified Point in view space. Method viewToSheet(viewPt As Point) As Point viewToSheet = iv_viewToSheet(self(), viewPt) End Method ' ' Converts the coordinates of the point in the Model units to these of the point in the Sheet units ' Method worldToView(p As Point) As Point Dim vp As Point = iv_modelToView(self(), p) Return Point( getX(vp)*viewScale, getY(vp)*viewScale, getZ(vp)*viewScale) End Method