I’m simply trying to add a dimension to my GHdoc by using either the commands rs.AddLinearDimension() or rs.AddAlignedDimension(). However, both are giving the error message as below:
Runtime error (NotSupportedException): This type of object is not supported in Grasshopper, so this Python script cannot create it. You might want to use ‘scriptcontext.doc = Rhino.RhinoDoc.ActiveDoc’ to use the Rhino doc, instead? If you do, remember to restore it: ‘scriptcontext.doc = ghdoc’.
Traceback:
line 45, in AddAlignedDimension, “C:\Users\matt.harwood\AppData\Roaming\McNeel\Rhinoceros\6.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\dimension.py”
line 349, in script
I’ve tried the suggestion, but this creates a baked dimension in the Rhino space which I don’t want.
Any ideas how to simply add a GH dimension using Python?
This is not a GhPython request alone. Grasshopper does not handle dimensions in their own right, so the same applies to GhPython. I know David has some plans for GH2.
What is available, is adding dimensions to the Rhino document (“baking”), as you noticed. That is already possible, also from GhPython. It would be possible to pass the ID of the created item, and modifying it in downstream components. For a more comprehensive view, I’ll defer this topic and wait for @DavidRutten’s opinions.
That component works fine, what I want to do though is write that functionality (or similar) into a Python script. I have a large script that creates some visual output that I’d like to add dimensions to. These only need to be visibly in the GH display and wont ever be baked into Rhino.
@piac I recently tried using the ghpythonlib.components module to use the AlignedDimesion component. However, despite the command running, no dimension seems to have been returned. What have I done wrong?
Ofcourse, the component has no outputs. In which case, how can I get the display that the component usually displays from that Python command? If it’s not possible, doesnt that render
The ghcomp library simply runs any component and provides its results. It’s automatic, and does exactly that.
If that component doesn’t have outputs, there’s not much it can do. You are basically requesting that Grasshopper returns aligned dimensions geometry, really.