Skip to content

Instantly share code, notes, and snippets.

{
"Uuid": "2493b807-0c2e-48d4-8838-e6c9b55015ed",
"IsCustomNode": false,
"Description": "",
"Name": "ChatGPT-Geometry generator",
"ElementResolver": {
"ResolutionMap": {
"Cuboid": {
"Key": "Autodesk.DesignScript.Geometry.Cuboid",
"Value": "ProtoGeometry.dll"
public static float[] ZToYTransform(this InwLTransform3f3 transform)
{
//Important casting to be made before quering the information from the COM class
dynamic matrix = transform.Matrix;
var _m = (Array)(object)matrix;
//Recreate current matrix
var _matrix = new Matrix4x4(
(float)(double)_m.GetValue(1), (float)(double)_m.GetValue(2), (float)(double)_m.GetValue(3), 0f,
(float)(double)_m.GetValue(5), (float)(double)_m.GetValue(6), (float)(double)_m.GetValue(7), 0f,
(float)(double)_m.GetValue(9), (float)(double)_m.GetValue(10), (float)(double)_m.GetValue(11), 0f,
public static float[] ZToY(this float[] point)
{
var trans = new Matrix4x4();
trans.Translation = new Vector3((float)point[0], (float)point[1], (float)point[2]);
var finalMatrix = Matrix4x4.Multiply(Matrix4x4.Multiply(_rotationMatrix, trans),
_invertedRotation);
var translation = finalMatrix.Translation;
return new float[] { translation.X, translation.Y, translation.Z };
}
private async void UploadPDF(byte[] pdfString, string channel_id, string user_name)
{
using (var httpClient = new HttpClient())
{
HttpResponseMessage? response = null;
var request = new HttpRequestMessage(new HttpMethod("POST"), "https://slack.com/api/files.upload");
JsonElement JO = new JsonElement();
request.Headers.TryAddWithoutValidation("Authorization", "Bearer XXXX");
public class Function
{
/// <summary>
/// Creates a PDF based on parameters
/// </summary>
/// <param name="Parameters"></param>
/// <param name="context"></param>
/// <returns></returns>
public string FunctionHandler(Dictionary<string?, string?> Parameters, ILambdaContext context)
{
public async Task<APIGatewayProxyResponse> FunctionHandler(APIGatewayProxyRequest request,
ILambdaContext context)
{
APIGatewayProxyResponse _APIGatewayProxyResponse = new APIGatewayProxyResponse();
_APIGatewayProxyResponse.StatusCode = 200;
_APIGatewayProxyResponse.Headers = new Dictionary<string, string>();
_APIGatewayProxyResponse.Headers.Add("Content-Type", "application/json");
_APIGatewayProxyResponse.Body = "In progress";
var Parameters = HttpUtility.ParseQueryString(request.Body);
@pderendinger-everse
pderendinger-everse / slackBot_01.cs
Last active April 26, 2022 19:05
Slackbot Async call
public async Task<APIGatewayProxyResponse> FunctionHandler(APIGatewayProxyRequest request,
ILambdaContext context)
{
APIGatewayProxyResponse _APIGatewayProxyResponse = new APIGatewayProxyResponse();
_APIGatewayProxyResponse.StatusCode = 200;
_APIGatewayProxyResponse.Headers = new Dictionary<string, string>();
_APIGatewayProxyResponse.Headers.Add("Content-Type", "application/json");
_APIGatewayProxyResponse.Body = "In progress";
var Parameters = HttpUtility.ParseQueryString(request.Body);