Wish - Annotations


#1

Hi,

I would like to recommend some improvements concerning annotation tools.

  1. Any annotation containing text should show the same properties to format the text. For example, it is actually not possible to set the character format like bold, italic, etc. on the text associated with leader…
  2. I would like to see any text object with an adjustable bounding box which we could use to set where the text is wrapping. AutoCAD is doing this the right way I think.
  3. I would like to be able to format the text over each word and not for the whole text object.
  4. Concerning “Fx” (text formula), why not be able to script them? The currently proposed formula are limited.

Thanks,


(Steve Baer) #2

I’m confused. Could you explain a little more about what you would like to see with respect to “scripting” of text formulas?


#3

Obviously, a scripted text formula need to return a “string”, so I see it this way.

Maybe somewhere in the options of the 3dm file we could create a list of named variables. Each named variables would be categorized as “String”, “Number”, etc. Then each named variables could be linked to a script (like rhinoscript) or an exposed function of a plugin which return the proper type.

Finally, inside the text properties we could add any named variables like %myvariable%…


(Steve Baer) #4

Are you saying you want to put a script inside a text formula or that you want more access to text formulas in things like RhinoScript, python, RhinoCommon?


#5

Let say this as a simple example,

Inside a RhinoCommon plugin I could have this exposed function :

public string LeftActiveViewName(int length)
{
    string result = "";
    if (length > 0)
    {
        RhinoDoc doc = Rhino.RhinoDoc.ActiveDoc;
        string view_name = doc.Views.ActiveView.ActiveViewport.Name;
        result = (view_name.Length < length) ? view_name.Substring(0, length) : view_name;
    }
    return result;
}

Inside the text properties I would type inside :
The page layout number is : %LeftActiveViewName(3)%

The text object should then show this if the page layout name is “001 Layout” :
The page layout number is : 001

My example directly “link” a text formula to a function, but I guess it needs an interface between them which I describe in the previous post as a list of “named variables”. So to answer your question, my request is to be able to create custom text formula using any of the supported laguage like RhinoScript, RhinoCommon, etc. Maybe the ability to put a script inside the text object properties would be also interesting, but I think it would be more useful to associate script inside a list of “named variables”, that way we could use it in many text objects…

It is more clear?


(Steve Baer) #6

Yes, that is more clear; thanks. I looked into adding support for this in V5 and decided not to expose the functionality until we knew that we could limit the scope of what the string evaluation routines could do since the scripts would be run without the user’s knowledge when the textfield is being displayed.

By limiting, we want to make sure you can’t write some script that performs malicious actions (deleting of files would be one such action).


#7

That’s a good point about the malicious scripts. So probably the interface between code and custom text formula (which I previously named “named variables list”), could be used to test the conformity of the code.


(Steve Baer) #8

How do you suggest that is done? How would I block someone from writing

public string LeftActiveViewName(int length)
{
  string result = "";
  if (length > 0)
  {
    // HA, HA, I'm evil
    System.IO.File.Delete("somerandomfile");

    RhinoDoc doc = Rhino.RhinoDoc.ActiveDoc;
    string view_name = doc.Views.ActiveView.ActiveViewport.Name;
    result = (view_name.Length < length) ?
                        view_name.Substring(0, length) : view_name;
  }
  return result;
}

#9

Probably any custom text formula needs to be derived from a specific class (let’s say TextFormulaClass) that only allows the execution of some predetermined code. So in that scope, you could simply exposed what is permitted).Maybe something like Google done for their Google App Script.


#10

Hi,

Is it possible to do some arithmetic operation with the text formula. I did try this to convert the area value from square inches to square feets, but it doesn’t seem to work. In fact it does not see the “/144” at all.

%<area("id")/144>%

Also, I tried this to do the total of 2 areas, but doesn’t work again

%<(area("id1")+area("id2"))/144>%

A some functions to round result (round, floor and ceiling) would be also appreciated,

%<(round(area("id1")+area("id2"))/144;0)>%

Thanks


(Steve Baer) #11

Not currently. It is on the wishlist for V6