I know the formula for adding a length constraint for a line, but I can only do it by putting a number (or number + unit) in the parameter corresponding to the length to be imposed.
This code is ok with my squetch :
Code: Select all
App.getDocument('test').getObject('Sketch').addConstraint(Sketcher.Constraint('DistanceY',1,1,1,2,App.Units.Quantity("123,00 mm")))
I tried
Code: Select all
App.getDocument('test').getObject('Sketch').addConstraint(Sketcher.Constraint('DistanceY',1,1,1,2,App.Units.Quantity("Spreadsheet.Alias")))
Code: Select all
App.getDocument('test').getObject('Sketch').addConstraint(Sketcher.Constraint('DistanceY',1,1,1,2,App.Units.Quantity("=Spreadsheet.Alias")))
error message : ValueError: syntax error
OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 2022.1128.26244 +5318 (Git)
Build type: Release
Branch: LinkDaily
Hash: d45d221edcc7a757eb4e4eb638da0db5ed2759aa
Python version: 3.8.10
Qt version: 5.15.2
Coin version: 4.0.1
OCC version: 7.6.2
Locale: French/France (fr_FR)