Hi all,using Vector Display or Line Dimension via ghpythonlib is it not possible to view the result?
it is not even possible to display a text via ghpythonlib?
would it be feasible with the use of Rhinocommon?
You can pipe into
DrawViewportWires in GHPython SDK mode and draw all sorts of fancy things. Here’s a quick example emulating the standard
Vector Display Ex component:
220607_DrawLineArrow_00.gh (5.0 KB)
For drawing dimensions you probably want to have a look at the
Hi @AndersDeleuran thanks for the reply,
these programming methods i just can’t put them in my head they are really complicated. now i try to add annotation method as you advised me and i will let you know, i hope to succeed
ps this is my first time using python in this mode
sorry @AndersDeleuran I tried with these final 2 lines but apparently in both cases nothing comes back.
ps I don’t know if the DrawAnnotation method is the same as Line Dimension in Gh.
if it is not the same thing, it would be enough for me to insert a text in the center of the line,
in practice the intent is to display the text of the length of the line in the center of the same.
Yes it’s a wee bit more involved than that. You need to first create e.g. a
LinearDimension object, and then pass that as the first argument of the
DrawAnnotation method. Here’s a quick example:
220608_DrawLinearDimension_00.gh (3.4 KB)
thank you very much @AndersDeleuran
wauuu I would never get there, too many parameters.
sorry if I add something else,
still using Draw what would be the syntax if I wanted to add only a text aligned to the center of the line?
I had already done some research before but unfortunately I cannot find the right solution,
and even if I try to change the codes I have found that this type of programming is very hard.
I suggest all these viewport display/preview things need to have “View Filter” to do better tricks…
You could edit the script I posted to generate the input plane from the two line endpoints, like so:
220610_DrawLinearDimension_00.gh (6.3 KB)
If you just need to draw text at a point, the simplest solution is probably the
Draw2dText method (which draws in screen space). For 3D text, have a look at
Draw3dText (which draws in world space and thus requires more information/inputs).
I’m not sure what you mean by “better tricks”. But one can add a conditional to only draw in desired viewports:
the latter solution is fine, there’s just one problem (hope it’s not a bug)
if you draw a line between two points that forms the diagonal between the corners of the grid square, the display disappears. apart from this, but the text of the length would it be possible to increase the size?
ps yes I saw in the forum various examples of the two methods of inserting text,
but I could not modify them to get the text I needed.
I suspect that’s the plane generation, which will align the text3D with a different view angle. So one would have to compute that more explicitly to what one is aiming for (e.g. only draw in topview, to the active viewport). The arrow/text size is controlled by the Rhino document dimension styles settings
Here’s the basic case I mentioned above:
220611_DrawText2D_00.gh (6.6 KB)
in the test I had done I had not put the boolean value
Can we create a graph of points and vectors