1

I'm completely new to Rhino Python Script and struggling with the following problem. Having coded the creation of a user defined arc by radius, start point and magnitude. I need to automate the Selection and Dimensioning of this arc immediately with this creation!

I've failed to find a 'rhinoscriptsyntax' method to dimension an angle, alternatively I've failed to code 'Select' the arc in an rs.Command("_DimAngle "). In short I can't pass a selected object to an angle dimension command!

Please also note that I need and have used rs.DimensionUserText(... to add some extra text to manually created angle dimensions.

Can someone kindly point me in the right direction as I'm at the point where I'm suspecting I've seriously missed something obvious.

Thanks in anticipation.

  • Do I understand you right? You want to create an Anglular Dimension based on an Arc ? – Goswin Rothenthal Dec 01 '13 at 17:49
  • To clarify. I want to retrieve values from user command line eg. "Radius:" 1.5 "Angle:" 120 and from those values create an arc at 0,0,0 then to dimension it with additional text to the dimension. – user3050649 Dec 02 '13 at 16:54
  • Can't find an "AddAngleDimension" similar to this Linear one! rs.AddLinearDimension( start_point, end_point, point_on_dimension_line ) and Can't make rs.Command("_Dimangle".... accept any object identifier or work on preselected arc! – user3050649 Dec 02 '13 at 17:55

3 Answers3

1

If you do not find a function in Rhino Python Script, you can use the command (rs.Command) or the Rhino Common

BenMorel
  • 34,448
  • 50
  • 182
  • 322
Gianpaolo
  • 11
  • 4
1

One of the things you can do is name the object, then select it when using rs.Command():

 import rhinoscriptsyntax as rs

 rs.Command('_Arc') 
 arc = rs.LastCreatedObjects()[0]
 rs.ObjectName(arc,"Arc") 
 rs.Command("_DimAngle -selname Arc")
0

Like Gianpaolo said, you can draw an Angular Dimension via RhinoCommon but it involves a few steps:

First create an Arc geometry: http://4.rhino3d.com/5/rhinocommon/html/M_Rhino_Geometry_Arc__ctor_4.htm (This Arc is just in memory not in your drawing.)

use it to create an Angular Dimension: http://4.rhino3d.com/5/rhinocommon/html/M_Rhino_Geometry_AngularDimension__ctor.htm

and draw it to the document: http://4.rhino3d.com/5/rhinocommon/html/M_Rhino_DocObjects_Tables_ObjectTable_AddAngularDimension.htm

You can see here how it is done for the other Dimension Types in Python: https://github.com/mcneel/rhinopython/blob/master/scripts/rhinoscript/dimension.py

Goswin Rothenthal
  • 2,244
  • 1
  • 19
  • 32