private static void SetSpecificDimensions(ChannelProfile dimensions, string sectionName, IMaterialFragment material, cSapModel model) { model.PropFrame.SetChannel(sectionName, material.Name, dimensions.Height, dimensions.FlangeWidth, dimensions.FlangeThickness, dimensions.WebThickness); if (dimensions.MirrorAboutLocalZ) { RecordFlippingError(sectionName); } }
/***************************************************/ public static double TorsionalConstant(this ChannelProfile profile) { double b = profile.FlangeWidth; double height = profile.Height; double tf = profile.FlangeThickness; double tw = profile.WebThickness; return((2 * (b - tw / 2) * Math.Pow(tf, 3) + (height - tf) * Math.Pow(tw, 3)) / 3); }
public static string Description(this ChannelProfile profile) { if (profile == null) { return("null profile"); } return($"Channel {profile.Height:G3}x{profile.FlangeWidth:G3}x{profile.WebThickness:G3}x{profile.FlangeThickness:G3}"); }
public override bool Execute(ExecutionInfo exInfo = null) { var profile = new ChannelProfile(Depth, Width, FlangeThickness, WebThickness, RootRadius); profile.Material = Material; Section = Model.Create.SectionFamily(Name, exInfo); Section.Profile = profile; return(true); }
/***************************************************/ private bool SetProfile(ChannelProfile profile, string sectionName, IMaterialFragment material) { bool success = m_model.PropFrame.SetChannel(sectionName, material?.DescriptionOrName() ?? "", profile.Height, profile.FlangeWidth, profile.FlangeThickness, profile.WebThickness) == 0; if (success && profile.MirrorAboutLocalZ) { RecordFlippingError(sectionName); } return(success); }
/***************************************************/ public static double WarpingConstant(this ChannelProfile profile) { double width = profile.FlangeWidth; double height = profile.Height; double tf = profile.FlangeThickness; double tw = profile.WebThickness; return(tf * Math.Pow(height, 2) / 12 * (3 * width * tf + 2 * height * tw / (6 * width * tf + height * tw))); }
/***************************************************/ public static ChannelProfile InterpolateProfile(ChannelProfile startProfile, ChannelProfile endProfile, double parameter, int interpolationOrder, double domainStart = 0, double domainEnd = 1) { return(Create.ChannelProfile( Interpolate(startProfile.Height, endProfile.Height, parameter, interpolationOrder, domainStart, domainEnd), Interpolate(startProfile.FlangeWidth, endProfile.FlangeWidth, parameter, interpolationOrder, domainStart, domainEnd), Interpolate(startProfile.WebThickness, endProfile.WebThickness, parameter, interpolationOrder, domainStart, domainEnd), Interpolate(startProfile.FlangeThickness, endProfile.FlangeThickness, parameter, interpolationOrder, domainStart, domainEnd), Interpolate(startProfile.RootRadius, endProfile.RootRadius, parameter, interpolationOrder, domainStart, domainEnd), Interpolate(startProfile.ToeRadius, endProfile.ToeRadius, parameter, interpolationOrder, domainStart, domainEnd), startProfile.MirrorAboutLocalZ)); }
private static JObject ConstructChannelProfileObject(ChannelProfile profile) { JObject botChannelProfile = new JObject(); botChannelProfile.Add("bot_channelid", profile.ChannelID); botChannelProfile.Add("bot_conversationid", profile.ConversationID); botChannelProfile.Add("bot_fromid", profile.FromID); botChannelProfile.Add("bot_fromname", profile.FromName); botChannelProfile.Add("bot_recipientid", profile.RecipientID); botChannelProfile.Add("bot_recipientname", profile.RecipientName); botChannelProfile.Add("bot_serviceurl", profile.ServiceURL); botChannelProfile.Add("bot_name", profile.ProfileName); return(botChannelProfile); }
public static double TorsionalConstant(this ChannelProfile profile) { double b = profile.FlangeWidth; double h = profile.Height; double tf = profile.FlangeThickness; double tw = profile.WebThickness; double r = profile.RootRadius; double alpha = AlphaLJunction(tw, tf, r); double D = InscribedDiameterLJunction(tw, tf, r); //Note that 'P385 Design of steel beams in torsion' states that the reduction in the end should only be `- 0.210 * Math.Pow(tf, 4);` //As orange and blue book is using `- 0.420 * Math.Pow(tf, 4);`, and this is more conservative, using the latter until clarified. return((2 * b * Math.Pow(tf, 3) + (h - 2 * tf) * Math.Pow(tw, 3)) / 3 + 2 * alpha * Math.Pow(D, 4) - 0.420 * Math.Pow(tf, 4)); }
private async Task LocationDialogResumeAfter(IDialogContext context, IAwaitable <string[]> result) { try { geoCoordinates = await result; string type = string.Empty; switch (message) { case "graffiti": type = AppConstants.GRAFFITI_SR_TYPE; break; case "pothole": type = AppConstants.POTHOLE_SR_TYPE; break; default: break; } ServiceRequest sr = new ServiceRequest { Latitude = geoCoordinates[0], Longitude = geoCoordinates[1], ServiceRequestType = type }; ChannelProfile profile = new ChannelProfile { ChannelID = context.Activity.ChannelId, ConversationID = context.Activity.Conversation.Id, FromID = context.Activity.From.Id, FromName = context.Activity.From.Name, RecipientID = context.Activity.Recipient.Id, RecipientName = context.Activity.Recipient.Name, ProfileName = string.Format("{0}'s Profile", context.Activity.From.Name), ServiceURL = context.Activity.ServiceUrl }; //create a service request record in Dynamics 365 D365WebApi.CreateServiceRequest(sr, profile); } catch (TooManyAttemptsException) { await context.PostAsync(AppConstants.TRY_AGAIN); } }
/***************************************************/ private bool CreateProfile(string name, ChannelProfile profile) { Engine.Base.Compute.RecordWarning("Toe radius not support for ChannelSection"); List <double> dimensionList = new List <double> { profile.FlangeWidth, profile.Height, profile.FlangeThickness, profile.WebThickness, profile.RootRadius }; double[] dimensionArray = dimensionList.ToArray(); //List<string> valueList = new List<string> { "B", "D", "tf", "tw", "r" }; int lusasType = 10; CreateLibrarySection(name, dimensionArray, lusasType); return(true); }
/***************************************************/ public static string Description(this ChannelProfile profile) { return("Channel " + profile.Height + "x" + profile.FlangeWidth + "x" + profile.WebThickness + "x" + profile.FlangeThickness); }
public virtual string BuildServiceProfileUrl(ChannelProfile profile) { return(String.Empty); }
/***************************************************/ /**** Public methods ****/ /***************************************************/ public static IFramingElementProperty FramingElementProperty(this FamilyInstance familyInstance, RevitSettings settings, Dictionary <string, List <IBHoMObject> > refObjects = null) { if (familyInstance == null || familyInstance.Symbol == null) { return(null); } ConstantFramingProperty framingProperty = refObjects.GetValue <ConstantFramingProperty>(familyInstance.Id); if (framingProperty != null) { return(framingProperty); } // Convert the material to BHoM. ElementId structuralMaterialId = familyInstance.StructuralMaterialId; if (structuralMaterialId.IntegerValue < 0) { structuralMaterialId = familyInstance.Symbol.LookupParameterElementId(BuiltInParameter.STRUCTURAL_MATERIAL_PARAM); } Material revitMaterial = familyInstance.Document.GetElement(structuralMaterialId) as Material; if (revitMaterial == null) { revitMaterial = familyInstance.Category.Material; } string materialGrade = familyInstance.MaterialGrade(settings); BH.oM.Physical.Materials.Material material = revitMaterial.MaterialFromRevit(materialGrade, settings, refObjects); // If Revit material is null, rename the BHoM material based on material type of framing family. if (material != null && revitMaterial == null) { material.Name = String.Format("Unknown {0} Material", familyInstance.StructuralMaterialType); material.Properties.Add(familyInstance.StructuralMaterialType.EmptyMaterialFragment(materialGrade)); } IProfile profile = familyInstance.Symbol.ProfileFromRevit(settings, refObjects); if (profile == null) { familyInstance.Symbol.NotConvertedWarning(); } if (familyInstance.Mirrored) { if (profile is FreeFormProfile) { BH.oM.Geometry.Plane mirror = new oM.Geometry.Plane { Normal = BH.oM.Geometry.Vector.XAxis }; profile = BH.Engine.Spatial.Create.FreeFormProfile(profile.Edges.Select(x => x.IMirror(mirror))); } else if (profile is AngleProfile) { AngleProfile angle = ((AngleProfile)profile); profile = BH.Engine.Spatial.Create.AngleProfile(angle.Height, angle.Width, angle.WebThickness, angle.FlangeThickness, angle.RootRadius, angle.ToeRadius, true, false); } else if (profile is ChannelProfile) { ChannelProfile channel = ((ChannelProfile)profile); profile = BH.Engine.Spatial.Create.ChannelProfile(channel.Height, channel.FlangeWidth, channel.WebThickness, channel.FlangeThickness, channel.RootRadius, channel.ToeRadius, true); } } double rotation = familyInstance.OrientationAngle(settings); framingProperty = BH.Engine.Physical.Create.ConstantFramingProperty(profile, material, rotation, familyInstance.Symbol.Name); //Set identifiers, parameters & custom data framingProperty.SetIdentifiers(familyInstance.Symbol); framingProperty.CopyParameters(familyInstance.Symbol, settings.ParameterSettings); framingProperty.SetProperties(familyInstance.Symbol, settings.ParameterSettings); refObjects.AddOrReplace(familyInstance.Id, framingProperty); return(framingProperty); }
/***************************************************/ private bool SetProfile(ChannelProfile bhomProfile, string sectionName, string matName) { int ret = m_model.PropFrame.SetChannel(sectionName, matName, bhomProfile.Height, bhomProfile.FlangeWidth, bhomProfile.FlangeThickness, bhomProfile.WebThickness); return(ret == 0); }
/// <summary> /// Create the service request in D365. /// </summary> /// <param name="sr"></param> /// <param name="profile"></param> public static async void CreateServiceRequest(ServiceRequest sr, ChannelProfile profile) { GetConnection(); try { //Create an HTTP client to send a request message to the CRM Web service. using (HttpClient httpClient = new HttpClient(messageHandler)) { //Specify the Web API address of the service and the period of time each request // has to execute. httpClient.BaseAddress = new Uri(serviceUrl); httpClient.Timeout = new TimeSpan(0, 2, 0); //2 minutes httpClient.DefaultRequestHeaders.Add("OData-MaxVersion", "4.0"); httpClient.DefaultRequestHeaders.Add("OData-Version", "4.0"); httpClient.DefaultRequestHeaders.Accept.Add( new MediaTypeWithQualityHeaderValue(AppConstants.JSON_CONTENT_TYPE)); //Find if there is a bot channel profile for the particular conversation id HttpRequestMessage getBotChannelProfileRequest = new HttpRequestMessage(HttpMethod.Get, getVersionedWebAPIPath() + "bot_botchannelprofiles(bot_conversationid='" + profile.ConversationID + "')?$select=bot_botchannelprofileid"); var getBotChannelProfileResponse = await httpClient.SendAsync(getBotChannelProfileRequest); var createBotChannelProfileResponse = new HttpResponseMessage(); String channelProfileURI; //If it doesn't already exist, create a bot channel profile record. if (!getBotChannelProfileResponse.IsSuccessStatusCode) { //Create a Bot Channel Profile var botChannelProfile = ConstructChannelProfileObject(profile); HttpRequestMessage botChannelProfileCreateRequest = new HttpRequestMessage(HttpMethod.Post, getVersionedWebAPIPath() + "bot_botchannelprofiles"); botChannelProfileCreateRequest.Content = new StringContent(botChannelProfile.ToString(), Encoding.UTF8, AppConstants.JSON_CONTENT_TYPE); createBotChannelProfileResponse = await httpClient.SendAsync(botChannelProfileCreateRequest); channelProfileURI = createBotChannelProfileResponse.Headers.GetValues("OData-EntityId").FirstOrDefault(); } //If the record already exist, then obtain the channel profile id. else { var retrievedData = JsonConvert.DeserializeObject <JObject>( await getBotChannelProfileResponse.Content.ReadAsStringAsync()); var channelProfileId = retrievedData.GetValue("bot_botchannelprofileid").ToString(); channelProfileURI = httpClient.BaseAddress + getVersionedWebAPIPath() + "bot_botchannelprofiles(" + channelProfileId + ")"; } var srObject = ConstructServiceRequestObject(sr, channelProfileURI); var createSRRequest = new HttpRequestMessage(HttpMethod.Post, getVersionedWebAPIPath() + "bot_servicerequests"); createSRRequest.Content = new StringContent(srObject.ToString(), Encoding.UTF8, AppConstants.JSON_CONTENT_TYPE); var srResponse = await httpClient.SendAsync(createSRRequest); } } catch (Exception ex) { DisplayException(ex); throw; } }
public override string BuildServiceProfileUrl(ChannelProfile profile) { return(String.Format("http://www.facebook.com/profile.php?id={0}", profile.SourceAddress.Address)); }
private (double[], int, string) GetProfileDimensions(ChannelProfile profile) { return(new double[] { profile.FlangeWidth, profile.Height, 0, profile.FlangeThickness, profile.WebThickness, 0 }, St7.bsLipChannel, profile.Name); }
public override string BuildServiceProfileUrl(ChannelProfile profile) { return(String.Format("http://www.twitter.com/{0}", profile.ScreenName)); }
public override string BuildServiceProfileUrl(ChannelProfile profile) { return(String.Format("https://www.yammer.com/users/{0}", profile.SourceAddress.Address)); }
public override string BuildServiceProfileUrl(ChannelProfile profile) { return(profile.Url); }