private static void AddNewConnection(FamilyInstance beam) { bool isFound; Level beamLevel = null; double bottom_offset = 0.0; ParameterSet paras = beam.Parameters; //Built-in parameter does not work foreach (Parameter para in paras) { if (para.Definition.Name == "起点标高偏移") { bottom_offset = para.AsDouble(); continue; } if (para.Definition.Name == "参照标高") { beamLevel = _doc.GetElement(para.AsElementId()) as Level; continue; } } int beamFloor = _myLevel.GetFloor(out isFound, beamLevel, bottom_offset); if (!isFound) { _abandonWriter.WriteAbandonment(beam, AbandonmentTable.LevelNotFound); return; } Direction beamDire = GetBeamDirection(beam); if (beamDire == Direction.Undefined) { _abandonWriter.WriteAbandonment(beam, AbandonmentTable.SkewBeam); return; } bool isCross = IsBeamCrossColumn(beam, beamDire); int q = isCross ? 2 : 1; BeamSize beamSize = GetBeamSize(beam, beamDire); if (beamSize == BeamSize.Undefined) { _abandonWriter.WriteAbandonment(beam, AbandonmentTable.SteelJoint_BeamDepthOOR); return; } int tempDire = (byte)beamDire; int tempSize = (byte)beamSize; if (_num[tempDire, beamFloor] == 0 || _size[tempDire, beamFloor] < tempSize) { _size[tempDire, beamFloor] = tempSize; } _num[tempDire, beamFloor] += q; _levelRecord[tempDire].Push(beamFloor); }
private new void Start() { BeamMesh = GetComponent <MeshRenderer>(); targetPositions = new List <Vector3>(); targetDecart = new List <Vector3>(); targetDecart1 = new List <Vector3>(); targetVelocities = new List <Vector3>(); puAzimut = transform.parent.GetComponents <PuRotator>() .FirstOrDefault(script => script.rotateType == PuRotator.RotateType.Azimut); puElevation = transform.parent.GetComponents <PuRotator>() .FirstOrDefault(script => script.rotateType == PuRotator.RotateType.Elevation); widthBeam = transform.GetComponents <BeamSize>().FirstOrDefault(script => script.type == BeamSize.Type.Width); heightBeam = transform.GetComponents <BeamSize>().FirstOrDefault(script => script.type == BeamSize.Type.Height); targets = targetsGO.GetComponentsInChildren <Transform>() .Where((transform => transform.TryGetComponent(typeof(TargetMover), out _))) .ToList(); }