Giggetto_1974
Guest
Good morning, everyone. I generated a sweep with a 2d sketch, I would like to know the total length. I can't find solutions. I would also like to know the total length of a sketch.
Thank you.
Thank you.
error online 1 : 'syntaxeditor' not declared. may not be accessible due to its level of protection.questa regola di ilogic fa quello che chiedi:
syntaxeditor code snippet 'set a reference to the active part document
dim odoc as partdocument
odoc = thisapplication.activedocument
dim odef as partcomponentdefinition
odef = odoc.componentdefinition
dim opath as path
opath = odef.features.sweepfeatures.item("thesweep").path
dim totallength as double
totallength = 0
dim ocurve as object
dim i as integer
for i = 1 to opath.count
ocurve = opath.item(i).curve
dim ocurveeval as curveevaluator
ocurveeval = ocurve.evaluator
dim minparam as double
dim maxparam as double
dim length as double
call ocurveeval.getparamextents(minparam, maxparam)
call ocurveeval.getlengthatparam(minparam, maxparam, length)
totallength = totallength + length
next i
dim oparams as parameters
dim oparam as parameter
oparams = odoc.componentdefinition.parameters
dim exists as boolean
exists = false
'find out if parameter exists
for each oparam in oparams
if oparam.name = "sweeplength" then exists = true
next oparam
'change the value if the parameter exists otherwise add the parameter
if exists then
oparams.item("sweeplength").value = totallength
else
oparams.userparameters.addbyvalue( "sweeplength", totallength, 11266)
end if
odoc.update
ps:
you need to rename sweep processing with "thesweep"