script: Chamfer, Size2

In diesem Forum Fragen und Diskussionen in Deutsch
Forum rules
Foren-Regeln und hilfreiche Informationen

WICHTIG: Bitte zuerst lesen, bevor Sie posten
Post Reply
Rainer_B
Posts: 23
Joined: Tue Jun 15, 2021 3:07 pm
Location: Hamburg / Germany

script: Chamfer, Size2

Post by Rainer_B »

Hallo, ich habe Probleme einen Chamfer per script einzustellen

Code: Select all

doc=  App.ActiveDocument
oBody=doc.addObject('PartDesign::Body')

oShape1=doc.addObject('PartDesign::AdditiveBox')
oBody.addObject(oShape1)
oShape1.Length=10
oShape1.Width= 10
oShape1.Height=10

oShape2=oBody.newObject('PartDesign::Chamfer','Chamfer')
oShape2.Base = (oShape1,'Face6')
oShape2.Size = 1
oShape2.Size2 = 2			# !!!!

doc.recompute()
Gui.activeDocument().activeView().viewAxonometric()
Gui.SendMsgToActiveView("ViewFit")
Size2 wird zwar übernommen, kommt aber erst zur Wirkung, wenn ich händisch den Chamfer parameter Type auf Two distances ändere
Gruß Rainer
mario52
Veteran
Posts: 4701
Joined: Wed May 16, 2012 2:13 pm

Re: script: Chamfer, Size2

Post by mario52 »

hi

you forget : oShape2.ChamferType = u"Two distances"

Code: Select all

doc=  App.ActiveDocument
oBody=doc.addObject('PartDesign::Body')

oShape1=doc.addObject('PartDesign::AdditiveBox')
oBody.addObject(oShape1)
oShape1.Length=10
oShape1.Width= 10
oShape1.Height=10

oShape2=oBody.newObject('PartDesign::Chamfer','Chamfer')
oShape2.ChamferType = u"Two distances" # availlable u"Equal distance" (by default); u"Distance and Angle"
oShape2.Base = (oShape1,['Face6',])
oShape2.Size2 = 2.0			# !!!!
oShape2.Size = 1.0

doc.recompute()
Gui.activeDocument().activeView().viewAxonometric()
Gui.SendMsgToActiveView("ViewFit")

mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
Post Reply