@nm2107 a rectangular to rectangular can be directly triangulated, because it's easy to get all coordinates to work with.
As I suggested in an earlier reply, you may need a few python scripts that fit each type use case.
I have been experimenting with auto setting some points to triangulate, been tough going.
But I do agree with the mesh unwrap, I don't like that, I'd rather triangulate.
I have also worked on getting the true amount of stretch out for circular parts, as example.
If 16 segments is used, I have a factor I use.
Say a 10 inch diameter, the factor is 1.006455, so a 10.06455 inch diameter is used. Then when triangulated it lays it out to a 10 inch diameter stretch out. It just handles the small error in the polygon straight sections.
An XLS spreadsheet is attached.
Edit:
Code for arc / circle so far.
Code: Select all
# -*- coding: utf-8 -*-
import FreeCAD,FreeCADGui
import Draft
import math
import Get_circle_factor
from PySide import QtGui
WIRE = True
INPUTININCHES = True
if INPUTININCHES:
convert = 25.4
else:
convert =1.0
getDouble = QtGui.QInputDialog.getDouble
Vector, Placement = App.Vector, App.Placement
doc = App.ActiveDocument
sel = Gui.Selection.getSelectionEx()
start_point = Vector(0, 0, 0)
if sel:
sel, = sel
if sel.PickedPoints:
start_point = sel.PickedPoints[-1]
FLAG=0
TCLRD, tclrdflag = getDouble(None, 'example', 'Radius', decimals=3)
TCLRD *= convert
BASEON, baseonflag = getDouble(None, 'example', 'POLY no. sides 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 56, 60', decimals=0)
FS, fsflag = getDouble(None, 'example', 'Right segment - 1 Left segment 2', decimals=0)
baselist = [12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 56, 60]
exist_count = baselist.count(BASEON)
# checking if it is more than 0
if exist_count > 0:
based = BASEON
r = TCLRD
NEWTCLRD = Get_circle_factor.getfactor(based, r)
SANG = 0
EANG = 360
zaxis = App.Vector(0, 0, 1)
p1 = App.Vector(0, 0, 0)
place1 = App.Placement(p1, App.Rotation(zaxis, 0))
circle1 = Draft.make_circle(NEWTCLRD, placement=place1, face=None, startangle=SANG, endangle=EANG, support=None)
else:
print("Invalid number")
Function:
Code: Select all
# -*- coding: utf-8 -*-
import math
def getfactor(based=12, r=5):
global newclr
if based == 12:
newclr = r * 1.011516
return newclr
if based == 16:
newclr = r * 1.006455
return newclr
if based == 20:
newclr = r * 1.004125
return newclr
if based == 24:
newclr = r * 1.002863
return newclr
if based == 28:
newclr = r * 1.002102
return newclr
if based == 32:
newclr = r * 1.001609
return newclr
if based == 36:
newclr = r * 1.001268
return newclr
if based == 40:
newclr = r * 1.001029
return newclr
if based == 44:
newclr = r * 1.000851
return newclr
if based == 48:
newclr = r * 1.000715
return newclr
if based == 56:
newclr = r * 1.000525
return newclr
if based == 60:
newclr = r * 1.000458
return newclr
Edit:
I still haven't automated setting all points yet.
For the circular sections I can (kind of) automate point setting, but for flat section still manual setting.