• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

measure the total length of a sweep

  • Thread starter Thread starter Giggetto_1974
  • Start date Start date

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.
 
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"
 
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"
error online 1 : 'syntaxeditor' not declared. may not be accessible due to its level of protection.
error online 1 : the arguments of the method must be enclosed in brackets.
error online 1 : a comma, ')' or a valid expression continuation
error online 48 : planned end of education.
 
prova ad delineate la prima linea "syntaxeditor code snippet 'set a reference to the active part document"
 
error in rule: lunghezzasweep, in document: 8053 - cavi festone.ipt

the parameter is incorrect. (exception from hresult: 0x80070057 (e_invalidarg))
 
Do some evidence.
do a single sweep and rename the processing in the browser with thesweep
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top