Any script to label corners of model in oaoer space ?

Any script to label corners of model in oaoer space ?

Anonymous
Not applicable
736 Views
6 Replies
Message 1 of 7

Any script to label corners of model in oaoer space ?

Anonymous
Not applicable

hello everyone

 

is there any script (maybe trick in inv 2010 how to achive this) which can label selected points this way (in paper space):

< Xcoord , Ycoord, Zcoord >

now i export 3d model to autocad and then use lisp macro. but it is really time consuming.

when model is updated i need to do this again 😞

 

thanks

romek

0 Likes
Accepted solutions (1)
737 Views
6 Replies
Replies (6)
Message 2 of 7

xiaodong_liang
Autodesk Support
Autodesk Support

Hi,

 

I am not sure if it helps, could you take a look at this post?

http://adndevblog.typepad.com/manufacturing/2012/05/create-leadernote-which-is-constrained-with-one-...

0 Likes
Message 3 of 7

Anonymous
Not applicable

i'm totaly beginner with inv VBA. I don't know if there is something wrong on page or should i change something but original code not working. i made these modification:

 

Sub AddLeaderNoteWithHoleCenter()
    ' assumes you have had Inventor application
    Dim oDrawDoc As DrawingDocument
    Set oDrawDoc = ThisApplication.ActiveDocument

    Dim oActiveSheet As Sheet
    Set oActiveSheet = oDrawDoc.ActiveSheet

    ' get curve, assume a hole curve is selected
    Dim oDrawingCurveSegment As DrawingCurveSegment
    Set oDrawingCurveSegment = oDrawDoc.SelectSet(1)

    Dim oDrawingCurve As DrawingCurve
    Set oDrawingCurve = oDrawingCurveSegment.Parent

    ' get center point
    Dim oMidPoint As Point2d
    Set oMidPoint = oDrawingCurve.CenterPoint
    Dim oTG As TransientGeometry
    Set oTG = ThisApplication.TransientGeometry
    
    Dim oLeaderPoints As ObjectCollection
    Set oLeaderPoints = ThisApplication.TransientObjects.CreateObjectCollection
    
    Call oLeaderPoints.Add(oTG.CreatePoint2d(oMidPoint.X + 5, oMidPoint.Y + 5))

    ' Create geometry intent from center point
    Dim oGeometryIntent As GeometryIntent
    Set oGeometryIntent = oActiveSheet.CreateGeometryIntent(oDrawingCurve, oMidPoint)

    Call oLeaderPoints.Add(oGeometryIntent)
    
    Dim sText As String
    sText = "Leader Note for one hole center"
    
    ' add leader note
    Dim oLeaderNote As LeaderNote
    Set oLeaderNote = oActiveSheet.DrawingNotes.LeaderNotes.Add(oLeaderPoints, sText)

End Sub

 

now works fine Smiley Happy there is a lot of information in this code.

will see if i will be able to revise to fint into my needs

 

Last question. I can get XYZ coords of model but is it possible to create link ("inteligent leader") between model and paper leader so when model change then leader update ? or i can only use this to describe corner but without link ?

 

thank you very mych Xiaodong. this is a really big help.

regards

romek

0 Likes
Message 4 of 7

xiaodong_liang
Autodesk Support
Autodesk Support

Hi adservco,

 

firstly, i am glad to hear you got some worked code : -)

 

about "inteligent leader", what kind of update you required. e.g.

 

- if the leader lines would update with the curve changing

- if the text of the leader can change with the model changing.

- others?

 

since the leader is created from the curves intent CreateGeometryIntent, the leader lines should update automatically if the drawing curve updates because of the changing of model. But about text, I am afriad you need to watch the model changing event and look for the leader and update the text with the new content. Of course, you could also just provide a button in the drawing, and ask your user to remember to click it to get the latest status. This will save your more time to work out a nice workflow with event.

 

 

 

 

0 Likes
Message 5 of 7

Anonymous
Not applicable

1. let say i shown plan view of my model (paper space).

2. now i want to select point on my model and get X,Y,Z coordinates. (put leader with text)

3. when model change, move up, down, left, right then all X,Y, Z values are change

 

"inteligent leader" should update X,Y,Z text after 3d model changes.

 

thanks

romek

0 Likes
Message 6 of 7

xiaodong_liang
Autodesk Support
Autodesk Support
Accepted solution

Hi,

 

Sorry for the delay.

 

- if what you need is: when the model changes, the leader text can be changed automatically, you may have to start the DrawingViewEvents.OnViewUpdate and check whether the model is changed and update the text

 

- if it is fine with you to ask your user to click a button to execute update, you could just get the model (feature) information  and update it. 

 

In either case, you will need to get the model (feature) the leader attaches to. I happened to write a small code on it. Probably it could be a little help for you.

 

http://adndevblog.typepad.com/manufacturing/2013/04/get-model-document-from-leadernote.html

 

 

0 Likes
Message 7 of 7

Anonymous
Not applicable

really good example. i will try to combine all gathered informatiom and see where it takes me

 

thanks again

 

0 Likes