ArcCurve transformed at a non-uniform scale remains an ArcCurve


#1

This issue exists in both V5 & V6. Applying a transform with a non-uniform scale to an ArcCurve results in another ArcCurve. This can be demonstrated by using the script below on TransformArcCurve.3dm (74.2 KB).

Thank you,
Steve

import scriptcontext as sc
import rhinoscriptsyntax as rs

def main():
    idInst = rs.GetObject("Select block instance", filter=rs.filter.instance, preselect=True)
    if idInst is None: return
    
    idBlock = rs.BlockInstanceName(idInst)
    xform = rs.BlockInstanceXform(idInst)
    
    for idObj in rs.BlockObjects(idBlock):
        rdObj = sc.doc.Objects.Find(idObj)
        rgObj = rdObj.Geometry
        rgObj.Transform(xform)
        sc.doc.Objects.Add(rgObj)
    
    sc.doc.Views.Redraw()

if __name__ == '__main__': main()

RhinoCommon transformation failure
(Dale Fugier) #2

Hi Steve,

Not all geometry types can be accurately modified with squishy transformations like projections, shears, and non-uniform scaling. For example, if you were to apply a non-uniform scale to a circle, which is represented by an Rhino.Geometry.ArcCurve curve, the resulting geometry is no longer a circle.

When exploding an instance reference into its geometric form, as you are, first test to see if the instance reference’s transformation is a similarity transformation. This can be done by using Rhino.Geometry.Transform.SimilarityType.

If the transformation is not a similarity, then convert the geometry into its NURB form so that it can be accurately modified. Then apply the transformation.

– Dale


(Dale Fugier) #3

Also…

A sample:

https://github.com/dalefugier/SampleCsCommands/blob/master/SampleCsExplodeBlock.cs

And there is always Rhino.DocObjects.InstanceObject.Explode.

– Dale