Arc - BothSides?


#1

_Arc - BothSides

i could of used that a few times lately.
so just making a low level suggestion and/or seeing if anybody else would have uses for it.

(pick center point then the start point is actually the midpoint of the arc)


Wish : Arc from midpoint
#2

Hi Jeff
Try the below Python script:

# Python script Arc_BothSides
# Write by Ing. Vittorio Carlotto
# carlottovittorio@gmail.comn

import rhinoscriptsyntax as rs

def  Arc_BothSides():
        arrplane=rs.ViewCPlane()    
        rs.Command("_Arc")
        result=rs.LastCommandResult()
        if result==0:
            arc_id=rs.FirstObject()        
            pc=rs.ArcCenterPoint(arc_id)
            ps=rs.CurveStartPoint(arc_id)
            pe=rs.CurveEndPoint(arc_id)
            angle=rs.ArcAngle(arc_id)        
            matrot=rs.XformRotation2(angle,arrplane.ZAxis,pc)
            pb=rs.PointTransform(ps,matrot)
            result_2=rs.PointCompare(pe,pb)
            if result_2==True:
                matrot=rs.XformRotation2(angle,-arrplane.ZAxis,pc)
                pb=rs.PointTransform(ps,matrot)        
            rs.AddArc3Pt(pe,pb,ps)
            rs.DeleteObject(arc_id)
        else:
            return
Arc_BothSides()```
Ciao Vittorio

#3

Dang, Vittorio, you beat me to it…

However, I decided to use this as my first entry in the club of dynamic drawing scripts. It’s actually inspired from one of your scripts Vittorio !!  (the half circle) You set a center point and a midpoint (you can enter a value to constrain the midpoint to a radius as usual), then drag the arc to where you want it. You can alternatively type in an angle value and enter. I used the total included angle, not the half angle - don’t know what’s more convenient, but it’s easy to change.

So, here it is, I haven’t tested it extensively, and not at all on Mac, so @jeff_hammond let me know if it works for you…

–Mitch

(updated again… better initial plane control)

ArcFromMidpoint.py (2.7 KB)


#4

Hi Mitch
Thanks for your version.
There is an error at line 69:
I modified :
sPt=rs.PointTransform(gp.Point(),xFormR)
with
sPt=rs.PointTransform(mp,xFormR)

Ciao Vittorio


#5

nice fellas.
I’m drawing a little later today. I’ll try it out then. thanks


#6

Hi Vittorio,

Yeah, dumb error, sorry… Thanks for checking! I updated the original script…

Cheers, --Mitch


#7

Hi Mitch
The attached script is a modifycation of your script
Ciao Vittorio
ArcFromStartPoint_BothSides.py (2.5 KB)


#8

Ah, interesting variation, thanks Vittorio!

@jeff_hammond I updated the script again with some minor improvements… and it runs on Mac!

–Mitch


#9

finally got a chance to try it and it’s great. (the one from the 3rd post in this thread at the time of me posting this).
also, i really like the live feedback/dynamic aspects.

thanks a ton @vittorio @Helvetosaur !
this one is definitely getting an alias :wink:

————

i imagine both would have uses but i think you’ve written it the dominant way… the things i currently want to do with it are via inferencing but who knows, i might be bumping the topic in a few months asking how to switch it to 1/2 angle.