Leader, fx functions

Goal: have a leader point to an object (model and/or paperspace) with the “object name” function under the “fx” menu, in one click.
Currently the only way I know how to make this work is: run leader command, then click “fx”, then click “object name”, then click “select object”, then select the object, then click “okay”, and click “okay” again. This seems ridiculous to have to do that in 2023. Sounds like this could be handled in a script or macro, I am just not sure how to access the “fx” menu and the subsequent “clicks” to get the end result of just running a scripted/macro command that is one click.

Any help would be appreciated.

1 Like

this can surely be done iwith some script, but what do you mean by fx menu? if you mean to access the manu in the commandLine, you just need to use _-leader instead of leader.
sometimes a screenshot can help people like me to help you better.

Sorry should have said “text fields” not “fx”


1 Like

ok, the object name is stored in the objects attributes and I think you’ll need some code to access automatically, Rhinoscript won’t be enough I think.

Now some more questions:
-where do you want your point to aim at, where the other points?
-which plane?
-can you imagine workng with grasshopper?

Not sure what you mean by the point to aim at. All I need is a leader to point to an object and have the object name display without having to do six additional clicks to get there.

Preferably in any plane, but mainly just paperspace/layouts.

I can imagine all sorts of things in grasshopper, but that sounds like an even more convoluted way of getting to a leader that shows the object’s name.

I meant this:

where on the object? it must be a uniform solution that works for all geometry. like on the upper right corner with the text being shown a little higher and more right?

you can access the name in rhinoscript using Rhino.ObjectName(strObject)

using rhinoscript I got this, but I still don’t know where you want your points describing the leader:

Call Main()
Sub Main()
	Dim strObject, bbox, arrPts
	strObject = Rhino.GetObject("select object to display id")
	Rhino.AddLeader([yourPointArray], "Top", Rhino.ObjectName(strObject))
End Sub

fx is basically some code behind the value containing objects guid. instrad of absolute guid there could be something relative like “guid determined by where end of leader when snapping”

Hi Trevor - Here’s a quick Python that will do what I think you want in this case - it would be easy enough, I think, to expand it to use any of the supported fx.

NameLeader.py (423 Bytes)

To use the Python script use RunPythonScript, or a macro:

_-RunPythonScript "Full path to py file inside double-quotes"

@Trevor_O_Brien - just in case it helps making more of these from my starter, here is one for Area - a little more complicated cause you need to filter the selection to eligible objects. I guess it nmore or less replicates DimArea, though I forgot to include hatches.

AreaLeader.py (1.8 KB)

-Pascal

2 Likes

That is exactly what I was looking for. Thank you as always Pascal. And yes I will use that for other supported fx.

Hey Pascal. Thank you for helping with this. I was hoping you could help a bit more.
When I used the script a couple weeks ago I was certain that it worked in paper space (just like you would normally do with a leader). It does not seem to work in paper space. My scripting knowledge is basically nonexistent. I don’t know how to switch up the script to run a leader command first, then get the name info to display.

Any help is greatly appreciated.

Hi Trevor, I’ll take a look. The idea is to be able to have the leader in the layout but select the object from the 3d space, correct?
-Pascal

That is correct. Without having to activate a detail into model space (which doesn’t work correctly anyway). All I really need is to be able to run a script (it should work in paper and model space preferably), click the target, then click where I want the landing of the leader.

I totally thought it was working in paper space a couple weeks ago.

Were you able to get another look at this?

Hi Trevor - it turs out this is possible but you need to do things just right:

  1. Start Leader and place your points.
  2. In the dialog, click fX, and then Select.
  3. Now change the view to model space and select your object.
  4. Go back to the page space and make sure it is the active space before you click OK on the leader dialog.

Any luck?

-Pascal

None of that makes sense if trying to use the python script you set up. I have no idea how switch from paper space to model & model to paper space with out double clicking out in empty space. When I try that, the leader just goes where ever it wants from some arbitrary point.

From my understanding there is no possible way to use the script in paper space.


Red shows using a standard leader in paper space, which takes 9 clicks to get there.
Black shows trying to use the script (switching from paper to model to paper), which takes 5 clicks to get to a result that is unusable. That black line extends 6040 inches up to the right.

Am I missing something?