Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 4177

Creating/Baking angular dimensions from Python

$
0
0

tl;dr: I am creating/baking angular dimensions from Python, but negative angles never show a minus sign. How can I change the Dimension style to respect the sign? Or alternatively, how do I parse the result of ghpythonlib.components.AngularDimension(…) so I can bake it?

More detail:

I need to create/bake angular dimensions from Python code. I see 2 ways to do it:

  1. Use Rhino directly, like this: How to make Angular dimension by Python Rhino

  2. Use ghpythonlib.components to call the Grasshopper AngularDimension component directly.

I’ve gotten (1) to work correctly EXCEPT that the baked dimension never has a minus sign when I think it should: I’m passing in positive or negative numbers for the angle, as appropriate for different cases, but the dimension always shows as positive. For instance, here is my baked dimension (black) and a preview of the dimension produced by the Grasshopper component (red). the angle is specified at -144.9:

(Note I’m always referencing off the x axis, and I want clockwise positive and ccw negative.)

I would actually love to use (2), calling the component directly from Python with ghpythonlib.components, but I can’t for the life of me figure out how to parse the result. This code:

import ghpythonlib.components as ghcomp

res = ghcomp.AngularDimension(C,A,B,False,T,S)
print(res)

gives me this:

Array[object](())

But the array is zero length, and what do the nested parens mean?

In summary, I either need to figure out how to make the dimension style respect the sign of the angle I give it OR figure out how to parse the result of ghpythonlib.components.AngularDimension(…) so I can bake it.

Any help or insight deeply appreciated.

2 posts - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 4177

Latest Images

Trending Articles



Latest Images