Does Solidworks provide a way for me to set the attachment point of a note?
I know I can get the attachment point position from IAnnotation->GetAttachPos().
The drawback to that is not having the note leader actually attached to the edge. If you want to use linked values, it won't be linked to the component that it appears to be pointing to.
This is the problem that I encountered with inserting sketch blocks. I was trying to use them as BOM balloons (for special formatting rquirements, don't ask). To accomplish this without actually linking the balloons natively took some work.
What I was describing earlier was a method of selecting the edge that also lets you specify the selection location. I think if you take this route, you can accomplish your goal of specifying the insertion point and also keeping the leader linked to the component that it points to.
I would suggest looking at the selection manager for ways of selecting entities and specifying the selection point
2012 SOLIDWORKS API Help - ISelectionMgr Interface Members
2012 SOLIDWORKS API Help - SetSelectionPoint2 Method (ISelectionMgr)
Hello,Can you help me to get a solidworks2015 API document (not SDK,,it's the document which introduces the solidworks2015API) ,I will thank you very much.
My email address is email@example.com
Google SolidWorks API 2015. That's the best I have .
The INote interface has a method, GetAnnotation(), that returns an IAnnotation object which you can use to get the attachment point.
Look at this example.
Hope this helps!
I need to SET the attachment point of the note. I know how to get the attachment point.
Annotation.SetPosition doesn't do it for you?
Unfortunately not. IAnnotation->SetPosition only adjusts the position of the TEXT, it does not change the position of the leader arrow.
If I have a Note pointing to an edge in a drawing, and I wish to change the position of the arrow to another point on the same edge- how do I do so? I cannot seem to find any methods in the Solidworks api that allows me to do so.
As another example, can I get a Note to point to some arbitrary point in a drawing?
I looked for a way of doing this for a month back in the Spring (sw 2012). The only solution I came up with was to insert the note at the desired position for the leader arrow and then move the note to its final position. The leader will continue to point wherever it pointed upon insertion. The two biggest drawbacks to this method are that it is clunky and it doesn't attach the leader to components (even if the insertion point was dead on).
edit: This was for sketch block insertion but I think the principle is the same.
The current method I am using now is to attach notes to a selected edge in a drawing. When the note is created and attached - the attachment point defaults to the starting vertex of the edge. For example, if I'm attaching a note to a circle edge entity in a drawing, the default attachment point is the lower left of the circle.
Can I change this point to somewhere else on the edge?
Currently I'm going to try to create an arbitrary point at the position I want and have the note point to that, then delete the point.
Maybe there is a big difference between sketch block instance insertion and note insertion. The method for inserting sketch block instances takes a mathPoint as an argument for the position.
It appears that you are using InsertNote(). From the documentation:
"The leader attachment points for the new note come from the selections made before calling this method. The initial location of the note will be near the selection location."
Are you selecting the desired edge programatically in VBA or pre-selecting it in the model? I think you might be able to get the results you want by changing the selection method. The method that you are using probably assigns the end-point of the line segment as a the 'selection location' but there might be an alternative way of selecting the edge that will also allow you to specify the selection location.
This is just a hypothesis. One piece of information that might support it is the fact that when you pre-select an edge in the model before adding a note, you can manipulate the position of the leader based on the selection location (where you clicked when pre-selecting the edge).
I am indeed using the IModelDoc->InsertNote() method to insert a note. My project is a C++ standalone which creates a drawing without any input from the user. Thus, there is no 'pick' point to which I can reference.
My current route of investigation will be:
1. Create a new note at specified location on the drawing.
2. Get the origin of this note
3. Select an edge and use IEdge->GetClosestPointOn method to find the closest point of the note origin to that edge.
4. Create a sketch point at that closest point.
5. Attach the note to that sketch point
6. Delete the sketch point.
That's exactly what I'm looking for! Still a tad clunky, but otherwise useful. Thanks.
Retrieving data ...