Esempio n. 1
0
        /// <summary>
        /// Calculates the start hook angle for a rebar subelement, from the subelement cache. This is used for Free Form Rebar when the Workshop intructions are Bent.
        /// <param name="element">
        /// The element to calculate the value.
        /// </param>
        /// <param name="handle">
        /// The IFC handle that may offer parameter overrides.
        /// </param>
        /// <returns>
        /// True if the operation succeed, false otherwise.
        /// </returns>
        public override bool GetParameterFromSubelementCache(Element element, IFCAnyHandle handle)
        {
            Parameter param = element.get_Parameter(BuiltInParameter.REBAR_ELEM_HOOK_START_TYPE);

            if (param == null)
            {
                return(false);
            }

            if (param.Definition == null)
            {
                return(false);
            }

            ElementIdParameterValue paramVal = ParameterUtil.getParameterValueByNameFromSubelementCache(element.Id, handle, param.Definition.Name) as ElementIdParameterValue;

            if (paramVal != null)
            {
                RebarHookType hookType = element.Document.GetElement(paramVal.Value) as RebarHookType;
                if (hookType == null)
                {
                    return(false);
                }

                m_Angle = UnitUtil.ScaleAngle(hookType.HookAngle);

                return(true);
            }
            return(false);
        }
Esempio n. 2
0
        /// <summary>
        /// Calculates the shape code for a rebar subelement, from the subelement cache. This is used for Free Form Rebar when the Workshop intructions are Bent.
        /// <param name="element">
        /// The element to calculate the value.
        /// </param>
        /// <param name="handle">
        /// The IFC handle that may offer parameter overrides.
        /// </param>
        /// <returns>
        /// True if the operation succeed, false otherwise.
        /// </returns>
        public override bool GetParameterFromSubelementCache(Element element, IFCAnyHandle handle)
        {
            Parameter param = element.get_Parameter(BuiltInParameter.REBAR_SHAPE);

            if (param == null)
            {
                return(false);
            }

            if (param.Definition == null)
            {
                return(false);
            }

            ElementIdParameterValue paramVal = ParameterUtil.getParameterValueByNameFromSubelementCache(element.Id, handle, param.Definition.Name) as ElementIdParameterValue;

            if (paramVal != null)
            {
                Element rebarShape = element.Document.GetElement(paramVal.Value);
                if (rebarShape == null)
                {
                    return(false);
                }

                m_ShapeCode = rebarShape.Name;

                return(true);
            }
            return(false);
        }
Esempio n. 3
0
        internal RemoteGlobalParameter(GlobalParameter parameter, Units units)
        {
            Name  = parameter.Name;
            Type  = string.Empty;
            Value = string.Empty;

            if (parameter.GetValue().GetType() == typeof(StringParameterValue))
            {
                StringParameterValue dvalue = parameter.GetValue() as StringParameterValue;
                Type  = "Text";
                Value = dvalue.Value;
            }
            else if (parameter.GetValue().GetType() == typeof(IntegerParameterValue))
            {
                IntegerParameterValue dvalue = parameter.GetValue() as IntegerParameterValue;
                Type  = "Integer";
                Value = dvalue.Value.ToString();
            }
            else if (parameter.GetValue().GetType() == typeof(DoubleParameterValue))
            {
                UnitType        utype = parameter.GetDefinition().UnitType;
                DisplayUnitType dunit = units.GetFormatOptions(utype).DisplayUnits;

                DoubleParameterValue dvalue = parameter.GetValue() as DoubleParameterValue;
                Type  = "Number";
                Value = UnitUtils.ConvertFromInternalUnits(dvalue.Value, dunit).ToString();
            }
            else if (parameter.GetValue().GetType() == typeof(ElementIdParameterValue))
            {
                ElementIdParameterValue dvalue = parameter.GetValue() as ElementIdParameterValue;
                Type = "Element";
                if (dvalue.Value.ToString() != "-1")
                {
                    string elementname = parameter.Document.GetElement(dvalue.Value).Name;
                    Value = elementname;
                }
            }
        }
Esempio n. 4
0
        public PlateInJoint(Subelement subelem, RVTDocument doc, Settings sets)
        {
            _subelem = subelem;
            Reference   rf       = _subelem.GetReference();
            FilerObject filerObj = AdvanceSteelUtils.GetFilerObject(doc, rf);

            Autodesk.AdvanceSteel.Modelling.Plate pl = filerObj as Autodesk.AdvanceSteel.Modelling.Plate;
            //_volume = pl.Volume / (1000000 * 29.504);
            _volume = 1.0419239 * pl.Volume / (29504000);

            ParameterValue          pv   = _subelem.GetParameterValue(new ElementId(BuiltInParameter.STRUCTURAL_MATERIAL_PARAM));
            ElementIdParameterValue idpv = pv as ElementIdParameterValue;

            materialId = idpv.Value;
            _thickness = GetDimension <Subelement>(_subelem, DimensionKind.Thickness);
#if !R2019
            if (sets.writePlatesLengthWidth)
            {
                _length = GetDimension(_subelem, DimensionKind.Length);
                _width  = GetDimension(_subelem, DimensionKind.Width);
            }
#endif
        }
Esempio n. 5
0
        internal string EditParameter(Document doc, string name, string value)
        {
            try
            {
                IList <ElementId> globalparamids = GlobalParametersManager.GetGlobalParametersOrdered(doc);

                foreach (ElementId gid in globalparamids)
                {
                    GlobalParameter parameter = doc.GetElement(gid) as GlobalParameter;
                    if (!GlobalParametersManager.IsValidGlobalParameter(doc, parameter.Id))
                    {
                        continue;
                    }
                    if (parameter.IsDrivenByFormula)
                    {
                        continue;
                    }
                    if (parameter.Name == name)
                    {
                        if (parameter.GetValue().GetType() == typeof(StringParameterValue))
                        {
                            StringParameterValue dvalue = parameter.GetValue() as StringParameterValue;
                            dvalue.Value = value;
                            parameter.SetValue(dvalue);
                        }
                        else if (parameter.GetValue().GetType() == typeof(IntegerParameterValue))
                        {
                            if (value == "Yes")
                            {
                                value = "1";
                            }
                            else
                            {
                                value = "0";
                            }
                            IntegerParameterValue dvalue = parameter.GetValue() as IntegerParameterValue;
                            dvalue.Value = int.Parse(value);
                            parameter.SetValue(dvalue);
                        }
                        else if (parameter.GetValue().GetType() == typeof(DoubleParameterValue))
                        {
                            DoubleParameterValue dvalue = parameter.GetValue() as DoubleParameterValue;
                            UnitType             utype  = parameter.GetDefinition().UnitType;
                            DisplayUnitType      dunit  = Units.GetFormatOptions(utype).DisplayUnits;
                            double dp = double.Parse(value);
                            dvalue.Value = UnitUtils.ConvertToInternalUnits(dp, dunit);
                            parameter.SetValue(dvalue);
                        }
                        else if (parameter.GetValue().GetType() == typeof(ElementIdParameterValue))
                        {
                            ElementIdParameterValue dvalue = parameter.GetValue() as ElementIdParameterValue;

                            ElementId mat = FindMaterialByName(doc, value);

                            if (mat != null)
                            {
                                dvalue.Value = mat;
                                parameter.SetValue(dvalue);
                            }
                        }
                    }
                }
                return(value);
            }
            catch (Exception e)
            {
                return(e.Message);
            }
        }