private void assignOffsetTarget( SubassemblyTargetInfo target) { if (isRightSide(target.SubassemblyName)) { target.TargetIds = _targetRightOffset; } else { target.TargetIds = _targetLeftOffset; } }
// The following 2 methods are implemented under the // assumption that the subassembly name contains a // substring "Right" or "Left" depending on its side. // This is a big assumption that works on this // particular example, but you will have to get more // creative. // private void assignElevationTarget( SubassemblyTargetInfo target) { if (isRightSide(target.SubassemblyName)) { target.TargetIds = _targetRightElevation; } else { target.TargetIds = _targetLeftElevation; } }
private void assignTarget(SubassemblyTargetInfo target) { switch (target.TargetType) { case SubassemblyLogicalNameType.Surface: assignSurfaceTarget(target); break; case SubassemblyLogicalNameType.Elevation: assignElevationTarget(target); break; case SubassemblyLogicalNameType.Offset: assignOffsetTarget(target); break; } }
private void assignSurfaceTarget( SubassemblyTargetInfo target) { // The 'Add()' method of 'ObjectIdCollection' // knows nothing about subassembly targets; therefore // this call doesn't work. // // target.TargetIds.Add(surfaceId); target.TargetIds = _targetSurfaces; // Alternatively, you can get the collection, // manipulate it, and then set it again. // // ObjectIdCollection ids = target.TargetIds; // ... do whatever manipulations (add/remove targets) // target.TargetIds = ids; // // This will work, but trust me, my way (starting // clean) it is easier most of the time. }