Hi,
I have created a Python code that generates parts, assemblies, and drawings in SolidWorks 2025.
I want to add geometric tolerances to my drawings, but the display fails.
I tried it in VBA and it works, but the transition to Python is failing at the moment.
If anyone has any ideas or has already dealt with this kind of problem.
Thanks in advance.
#TOLERANCES GEOMETRIQUES
#PARALLELISME
#Insert reference element A
boolstatus = MEP.Extension.SelectByRay(170/1000, 150/1000, 0, 0, 0, -1, 0.1/1000, 1, False, 0, 0)
myDatumTag = MEP.InsertDatumTag2()
myDatumTag.FilledTriangle = True
myDatumTag.Shoulder = False
boolstatus = myDatumTag.SetLabel("A")
MEP.WindowRedraw()
MEP.ClearSelection2(True)
#Insert geometric tolerance parallelism
swGTol = MEP.InsertGtol()
if not swGTol is None :
swGTol.SetFrameSymbols2(1, "
swGTol.SetFrameValues2(1, "0.1", "", "A", "", "")
swGTol.SetPTZHeight2(1, 1, True, "50")
swGTol.SetBetweenTwoPoints(False, "", "")
swAnno = swGTol.GetAnnotation()
if swAnno :
swAnno.SetPosition(150/1000, 170/1000, 0)
swAnno.SetLeader3(2, 1, True, False, False, False)
swAnno.BentLeaderLength = 0.05
MEP.WindowRedraw()
MEP.ClearSelection2(True)
