Using iLogic to add a thread note

Using iLogic to add a thread note

harvey_craig2RCUH
Advocate Advocate
532 Views
3 Replies
Message 1 of 4

Using iLogic to add a thread note

harvey_craig2RCUH
Advocate
Advocate

I would like to add a thread note like this using iLogic:

harvey_craig2RCUH_0-1728029461654.png

I have played about with the sample on:

https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=HoleThreadNotes_Add_Sample

However I believe with the one point it give me a leader dimension and I need a linear diameter to achieve my picture. I would also like to have it placed without having to select edges so I can run the rule and it picks up the required GeometryIntent's or DrawingCurves (I've set prior) without human input. The descriptions mention a linear diameter example but I can't find it anywhere.

 

Any help would be appreciated. I've attached my sample, I didn't include any rules because I didn't even get close.

 

Thanks,

Harvey

0 Likes
Accepted solutions (1)
533 Views
3 Replies
Replies (3)
Message 2 of 4

WCrihfield
Mentor
Mentor
Accepted solution

Hi @harvey_craig2RCUH.  Drawing automation, such as dimension and note creation in drawings, is not really my area of focus, and I am not allowed to download or open your attached ZIP file, but I do have an idea that you may find helpful.  The HoleThreadNote Type is derived from the DiameterGeneralDimension Type, which itself is derived from the GeneralDimension Type, which is derived from the base DrawingDimension Type.  Anyways, since DiameterGeneralDimension only allows for one 'Intent', you obviously will not be able to use that one.  So, the next closest one that you could use would be the LinearGeneralDimension, then set its DimensionType property to the diametric variation of the DimensionTypeEnum, to convert it into a linear diameter type dimension, while using the GeneralDimensions.AddLinear method.

 

My thoughts were to...create the regular HoleThreadNote first, then create the LinearGeneralDimension, then copy the value of the HoleThreadNote.FormattedHoleThreadNote property, and paste that as the value of the LinearGeneralDimension.Text.FormattedText property.  Then delete the HoleThreadNote.  I know, it sounds like a lot of work, but so does attempting to create all the wanted formatted text you would want showing for the dimension from scratch, going by this:  XML Tags for FormattedText.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 4

harvey_craig2RCUH
Advocate
Advocate

Hi Wesley,

 

Thanks for the pointer. I got it working with your method. This is what I came up with:

 

Dim oDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oSheet As Sheet = oDoc.ActiveSheet
Dim oView As DrawingView = oSheet.DrawingViews.Item(1)
Dim oModelDoc = oView.ReferencedDocumentDescriptor.ReferencedDocument
Dim oNamedEntities = iLogicVb.Automation.GetNamedEntities(oModelDoc)
Dim MainSheet = ThisDrawing.ActiveSheet
Dim VIEW1 = MainSheet.DrawingViews.ItemByName(oView.Name)

Dim oFace1 As Face = oNamedEntities.FindEntity("Face0")
Dim filletCurves = oView.DrawingCurves(oFace1)

For Each oThreadEdge As DrawingCurve In filletCurves
    If oThreadEdge.EdgeType = kThreadEdge Then
        ' Create the thread note
        Dim oThreadNote As HoleThreadNote = oDoc.ActiveSheet.DrawingNotes.HoleThreadNotes.Add(ThisApplication.TransientGeometry.CreatePoint2d(5, 25), oThreadEdge)
        myThreadText = oThreadNote.Text.Text
        oThreadNote.Delete
        Exit For
    End If
Next

Dim Face0 = VIEW1.GetIntent("Face0")
Dim Thread_OD1 = VIEW1.GetIntent("Face0", nearPoint := VIEW1.SheetPoint(0.5, 0))
Dim Thread_OD2 = VIEW1.GetIntent("Face0", nearPoint := VIEW1.SheetPoint(0.5, 1))

Dim genDims = MainSheet.DrawingDimensions.GeneralDimensions
Dim ThreadDim = genDims.AddLinear("ThreadDim", VIEW1.SheetPoint(1.1, 0.5), Thread_OD1, Thread_OD2)
ThreadDim.NativeEntity.CenterText
ThreadDim.NativeEntity.HideValue = True
ThreadDim.NativeEntity.Text.FormattedText = myThreadText

harvey_craig2RCUH_0-1728053271110.png

 

It is not elegant but it works, is there anything you would do differently?

 

Thanks,

Harvey 

Message 4 of 4

WCrihfield
Mentor
Mentor

I'm glad I was able to help.  Like I said, this is not really my area of focus, so as long as it is working OK for you, and you understand your own code OK, that is what matters.  I did notice that you got the text from the HoleThreadNote.Text.Text property, instead of from the HoleThreadNote.FormattedHoleThreadNote property or from the HoleThreadNote.Text.FormattedText properties.  I'm guessing that they contained more information, or more pieces of information than what you wanted to show in that linear dimension, right?

 

What all gets included in a HoleThreadNote mainly depends on the settings within the DimensionStyle for those types of notes.  When you go into the Styles Editor dialog, and have a Dimension style selected, then go to the 'Notes and Leaders' tab on the right, then select the 'Hole Note Settings' icon, just under the tabs, then select a 'Note Format' from the drop-down list right under that, there are tons of extremely specific situations that you can customize the 'included pieces of information' for, and how each note will be formatted.  There are a lot of possibilities for what all pieces of information could be included, and how it could all be laid out or formatted.  That's partially why I said it would likely be easier to just copy the formatted text, than try to generate it from scratch with a custom String and XML tags. 😉

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes