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: 

Machined surface in IDW

6 REPLIES 6
Reply
Message 1 of 7
Raminasrl
299 Views, 6 Replies

Machined surface in IDW

Hi guys,

I want to put an engineering note to any machined surface of my part (IPT) so when I will create a drawing (IDW), it will appeare a leader note.

Is it possible to do that by Add-in?

 

Another way is to put a texture to any machined surface of my part (IPT) so when I will create a drawing (IDW), it will appeare a leader note indicating a machined surface.

 

Anybody could help me?Smiley Frustrated

Thanks

 

6 REPLIES 6
Message 2 of 7

Hi Raminasrl,

 

Engineering notes cannot be created from API. You could attach an attribute to your Face and use that from API to generate leader notes.

 

Take a look at "Custom Data/Working with Attributes" in the API Help Files.

 

Here is a sample from the help files that illustrates how to create a leader note:

 

Public Sub AddLeaderNote()
    ' Set a reference to the drawing document.
    ' This assumes a drawing document is active.
    Dim oDrawDoc As DrawingDocument
    Set oDrawDoc = ThisApplication.ActiveDocument

    ' Set a reference to the active sheet.
    Dim oActiveSheet As Sheet
    Set oActiveSheet = oDrawDoc.ActiveSheet

    ' Set a reference to the drawing curve segment.
    ' This assumes that a drawing curve is selected.
    Dim oDrawingCurveSegment As DrawingCurveSegment
    Set oDrawingCurveSegment = oDrawDoc.SelectSet.Item(1)

    ' Set a reference to the drawing curve.
    Dim oDrawingCurve As DrawingCurve
    Set oDrawingCurve = oDrawingCurveSegment.Parent

    ' Get the mid point of the selected curve
    ' assuming that the selected curve is linear
    Dim oMidPoint As Point2d
    Set oMidPoint = oDrawingCurve.MidPoint

    ' Set a reference to the TransientGeometry object.
    Dim oTG As TransientGeometry
    Set oTG = ThisApplication.TransientGeometry

    Dim oLeaderPoints As ObjectCollection
    Set oLeaderPoints = ThisApplication.TransientObjects.CreateObjectCollection

    ' Create a few leader points.
    Call oLeaderPoints.Add(oTG.CreatePoint2d(oMidPoint.X + 10, oMidPoint.Y + 10))
    Call oLeaderPoints.Add(oTG.CreatePoint2d(oMidPoint.X + 10, oMidPoint.Y + 5))

    ' Create an intent and add to the leader points collection.
    ' This is the geometry that the leader text will attach to.
    Dim oGeometryIntent As GeometryIntent
    Set oGeometryIntent = oActiveSheet.CreateGeometryIntent(oDrawingCurve)

    Call oLeaderPoints.Add(oGeometryIntent)

    ' Create text with simple string as input. Since this doesn't use
    ' any text overrides, it will default to the active text style.
    Dim sText As String
    sText = "API Leader Note"

    Dim oLeaderNote As LeaderNote
    Set oLeaderNote = oActiveSheet.DrawingNotes.LeaderNotes.Add(oLeaderPoints, sText)

    ' Insert a node.
    Dim oFirstNode As LeaderNode
    Set oFirstNode = oLeaderNote.Leader.RootNode.ChildNodes.Item(1)

    Dim oSecondNode As LeaderNode
    Set oSecondNode = oFirstNode.ChildNodes.Item(1)

    Call oFirstNode.InsertNode(oSecondNode, oTG.CreatePoint2d(oMidPoint.X + 5, oMidPoint.Y + 5))
End Sub
 

 

Hope this helps,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Message 3 of 7

Thanks Philippe,

this evening I will try.

Message 4 of 7

How can I find all oDrawingCurve in the drawing from face in the model?

Thanks for any help.Smiley Frustrated

Message 5 of 7

DrawingView.DrawingCurves Property

Parent Object: DrawingView

 

Description

Property that returns all the drawing curves within the drawing view optionally filtered to the input model object. This property returns Nothing for draft views.iew object represents a drawing view on a sheet.

 

Syntax

DrawingView.DrawingCurves( [ModelObject] As Variant ) As DrawingCurvesEnumerator

 

Parameters

Name Description
ModelObject Optional input object that specifies the object from the model for which the corresponding drawing view curves need to be retrieved. This could be an Edge, Face, PartFeature, Sketch, SketchEntity, Sketch3D, SketchEntity3D, ComponentOccurrence, or the proxies to any of these. If not specified, all the edges from the drawing view are returned.


Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Message 6 of 7

All is working, thanks.

 

 

 

Message 7 of 7

Sweet, please flag as solved (and give kudos ;))

 

Thanks,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

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

Post to forums  

Autodesk Design & Make Report