Hello,
I have a macro that inserts parts and creates constraints, it works great when I want to create slide constraints with a two-sided parallel slider, but not with a round slider. By doing it by hand it is not a problem, so to see where the problem comes from I created a simplified model with a round slider and a parallel and two corresponding slide constraints created by hand.
When I want to recreate a new constraint with the one previously created by hand, everything works fine, but not when I create it from scratch.
After investigation, it seems that the WidthMateFeatureData object used to create a new constraint only accepts 2 faces by default (when created with createMateData(11)) and " refuses " its modification with a single-sided slide.
Conversely, when it is created by hand with a single-sided slide, it " refuses " to be modified into a two-sided slide.
Do you know how to get the WidthMateFeatureData object to accept a round slider from scratch? (TabSelection attribute of size 1)
Or a trick to be able to create a width constraint with a round slider?
To be more precise, here is a piece of my commented code
'swCircularMateData : objet WidthMateFeatureData d’une contrainte glissière avec un coulisseau rond (créée à la main)
'swOldMateData : objet WidthMateFeatureData d’une contrainte glissière avec un coulisseau à deux faces parallèles (créée à la main)
Set swTestMateData = swCircularMateData 'récupère l'objet WidthMateFeatureData créé à la main
swAssembly.CreateMate swTestMateData 'crée la contrainte sans problème
Set swTestMateData = swAssembly.CreateMateData(11) 'crée un objet WidthMateFeatureData vide
'Recopie l'intégralité des attributs de l'objet
swTestMateData.ConstraintType = swCircularMateData.ConstraintType
swTestMateData.DistanceFromEnd = swCircularMateData.DistanceFromEnd
swTestMateData.FlipDimension = swCircularMateData.FlipDimension
swTestMateData.PercentDistanceFromEnd = swCircularMateData.PercentDistanceFromEnd
swTestMateData.TabSelection = swCircularMateData.TabSelection
swTestMateData.WidthSelection = swCircularMateData.WidthSelection
swAssembly.CreateMate swTestMateData 'la contrainte ne se crée pas
vTest = swTestMateData.TabSelection 'en inspectant l'attribut TabSelection, il s'avère être vide
swTestMateData.TabSelection = swParalleleMateData.TabSelection 'recopie l'attribut TabSelection de la contrainte avec le coulisseau parallele
swAssembly.CreateMate swTestMateData 'crée la contrainte sans problème