Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am placing multiple components using a C# addin, but one of them is flexible and not of the correct length, see below. How can I set the flexible component to the position I want?
I've tried moving the component directly, but this does not change the position, see example below. I've also tried modifying the model parameter of the MateConstraint, but that throw an exception with E_FAIL.
Beam beam = Selected.Beams.First();
ComponentOccurrence component = Components.Get(beam);
component.Flexible = true;
ComponentOccurrence[] clamps = component.SubOccurrences.Cast<ComponentOccurrence>().Where(c => c.Name.StartsWith("02-008")).ToArray();
Vector translation = Context.Application.TransientGeometry.CreateVector(946.2437, 0, 8.12);
clamps[1].Transformation.SetTranslation(translation);
Beam beam = Selected.Beams.First();
ComponentOccurrence component = Components.Get(beam);
double length = beam.Length * 100;
component.Flexible = true;
ComponentOccurrence[] clamps = component.SubOccurrences.Cast<ComponentOccurrence>().Where(c => c.Name.StartsWith("02-008")).ToArray();
MateConstraint[] mates = clamps.SelectMany(c => c.Constraints.OfType<MateConstraint>().Where(mate => mate.ConstraintLimits.MinimumEnabled && mate.ConstraintLimits.MaximumEnabled)).ToArray();
foreach (MateConstraint mate in mates) {
mate.Offset.Value = length;
}
Thanks in advance
Solved! Go to Solution.