home *** CD-ROM | disk | FTP | other *** search
- --This UPL program is used to update the radius of fillets or removing
- --fillets all together
-
- Proc Main
-
- Integer NEnt, I, IEnd, MibArc, MibLines(2)
- Real OldRad, NewRad, LineLen, RadRatio
- Coord ArcOrg, LEnd1(2), LEnd2(2), Int(2), LineEnd1, LineEnd2
-
- BreakChar = 3
-
- loop
- EntMask(0); EntMask(3) --only allow arcs to be picked
- Print "pick fillet to change: ",
- GetEnt(1, NEnt, MibArc, IEnd)
- exit when LastChar = BreakChar or NEnt < 1
-
- Verify Arc EntId(MibArc) Org(ArcOrg) Radius(OldRad)
-
- loop
- EntMask(0); EntMask(1) --only allow lines to be picked
- Print "dig lines connecting fillet: ",
- GetEnt(2, NEnt, MibLines(1), IEnd)
- exit all when LastChar = BreakChar or NEnt < 2
-
- --Get endpoints of lines
-
- Verify Line EntId(MibLines(1)) Ends(LEnd1(1),LEnd2(1))
- Verify Line EntId(MibLines(2)) Ends(LEnd1(2),LEnd2(2))
-
- --calculate intersection point of lines
-
- LinIntOf(LEnd1(1), LEnd2(1), LEnd1(2), LEnd2(2), Int(1), Int(2))
-
- --do a simple check to make sure the correct lines were picked
-
- exit when VLen(ArcOrg, Int(1)) <= 2.0*OldRad
- print; print '<the lines picked are not correct, try again>'
- end loop
-
- loop
- Accept NewRad Prompt(" new radius: ")
- exit when NewRad >= 0.0
- print; print '<must be a positive number, try again>'
- end loop
-
- --calculate new fillet origin
-
- if NewRad > 0.0 then
-
- --update fillet radius
-
- RadRatio = NewRad/OldRad
- ArcOrg = Int(1) + Coord(RadRatio,RadRatio,RadRatio)*(ArcOrg-Int(1))
- Modify Arc EntId(MibArc) Org(ArcOrg) Radius(NewRad) Rpnt(True)
- else
-
- --remove fillet
-
- Erase EntId(MibArc) Rpnt(True)
- endif
-
- --update lines end points
-
- loop I = 1 to 2
- if VLen(LEnd1(I), Int(I)) > VLen(LEnd2(I), Int(I)) then
- LineEnd1 = LEnd1(I)
- else
- LineEnd1 = LEnd2(I)
- endif
-
- LineLen = VLen(LineEnd1, Int(I))
- if NewRad > 0.0 then
- if LineLen > VLen(LEnd1(I), LEnd2(I)) then
- LineLen = LineLen-NewRad
- else
- LineLen = LineLen+NewRad
- endif
- endif
-
- LineEnd2 = LineEnd1 + \
- Coord(LineLen,LineLen,LineLen) * Vunit(Int(1) - LineEnd1)
-
- Modify Line EntId(MibLines(I)) Ends(LineEnd1, LineEnd2) Rpnt(True)
- end loop
- print
- end loop --loop to get more arcs and lines to change
-
- End Proc
-