rail dxf drawing any orientation to global xz planes
using System;
using System.Diagnostics;
using Tekla.Structures.Geometry3d;
using Tekla.Structures.Model;
using Tekla.Structures.Model.UI;
using Tekla.Structures;
using System.Collections.Generic;
using System.Linq;
using System.Collections;//.ArrayList;
using Tekla.Structures.Solid;
namespace Tekla.Technology.Akit.UserScript
{
/// <summary>
/// Internal class for running logic
/// </summary>
public class Script
{
// // // Beam Beam1 = new Beam();
// // // Beam Beam2 = new Beam();
// // // Point Point1 = new Point();
// // // CoordinateSystem Csys1 = Beam1.GetCoordinateSystem();
// // // CoordinateSystem Csys2 = Beam2.GetCoordinateSystem();
// // // Matrix Matrix = MatrixFactory.ByCoordinateSystems(Csys1, Csys2);
// // // Point Point2 = Matrix.Transform(Point1);
// // // // The same result for Point2 when using two separate transformations
// // // Matrix ToCurrentWP = MatrixFactory.FromCoordinateSystem(Csys1);
// // // Point CurrentPoint = ToCurrentWP.Transform(Point1);
// // // Matrix ToLocal = MatrixFactory.ToCoordinateSystem(Csys2);
// // // Point2 = ToLocal.Transform(CurrentPoint);
public static int edge_counter=0;
public static View ViewSelected=null;
public static int public_static_identifier_id_int_for_picked_object_to_draw_assembly=0;
public static int public_static_identifier_id_int_for_picked_object_to_decide_front_view_and_top_view_in_dxf=0;
public static int public_static_identifier_id_int_for_automatically_preserving_main_part_of_current_assembly=0;
public static TransformationPlane public_static_TransformationPlane___from___public_static_identifier_id_int_for_picked_object_to_decide_front_view_and_top_view_in_dxf=null;
public static CoordinateSystem public_static_To_Coordinate_system___public_static_identifier_id_int_for_picked_object_to_decide_front_view_and_top_view_in_dxf=null;
public static Color Red { get { return new Color(1.0, 0.0, 0.0); } }
public static Color Blue { get { return new Color(0.0, 0.0, 1.0); } }
public static Color Green { get { return new Color(0.0, 1.0, 0.0); } }
public static Vector PUBLIC_STATIC_PRESERVED_X_AXIS_GLOBAL_VECTOR=null;
public static Vector PUBLIC_STATIC_PRESERVED_Y_AXIS_GLOBAL_VECTOR=null;
public static Vector PUBLIC_STATIC_PRESERVED_Z_AXIS_GLOBAL_VECTOR=null;
public static double ANGLE_OF_LOCAL_X_AXIS_ON_GLOBAL_XY_FIRST_QUADRANT_GLOBAL_IN_RADIAN=0;
public static double ANGLE_OF_LOCAL_X_AXIS_ON_GLOBAL_XZ_FIRST_QUADRANT_GLOBAL_IN_RADIAN=0;
public static double ANGLE_OF_LOCAL_X_AXIS_ON_GLOBAL_YZ_FIRST_QUADRANT_GLOBAL_IN_RADIAN=0;
public static Vector THE_Z_AXIS_AS_ROTOR_AXIS_VECTOR___AT_LOCAL_ORIGIN__AND_ALONG_GLOBAL_Z=null;
public static Vector THE_PROJECTIONS_VECTOR_OF_LOCAL_X_ON_GLOBAL___XY_PLANE_AT_LOCAL_ORIGIN=null;
public static Matrix PUBLIC_STATIC_MATRIX_PRESERVED___transformationsMatrixToGlobal=null;
public static TransformationPlane PUBLIC_STATIC_PRESERVED_GLOBAL_TRANSFORMATION_PLANE=null;
public static GraphicsDrawer public_static_Script_graphicsdrawer_at_starting = null;//new GraphicsDrawer();
/// <summary>
/// Internal method run automatically by Tekla Structures if using as raw c# file
/// </summary>
/// <param name="akit">Passed argument automatically by core when using as macro</param>
public static void Run(IScript akit)
{
// ViewHandler.SetRepresentation("standard");
ModelViewEnumerator ViewEnumerator = ViewHandler.GetAllViews();
while (ViewEnumerator.MoveNext())
{
View ViewSelected= ViewEnumerator.Current;
Tekla.Structures.Model.UI.ViewHandler.RedrawView(ViewSelected);
// // // ViewHandler.ShowView(ViewSel);
// // // ViewHandler.RedrawView(ViewSel);
// // // ViewHandler.HideView(ViewSel);
}//while (ViewEnumerator.MoveNext())
Script.PUBLIC_STATIC_PRESERVED_GLOBAL_TRANSFORMATION_PLANE
=
(new Tekla.Structures.Model.Model()).GetWorkPlaneHandler().GetCurrentTransformationPlane();
//Get transformation matrix
// var transGlobal = new Model().GetWorkPlaneHandler().GetCurrentTransformationPlane().TransformationMatrixToGlobal;
Script.PUBLIC_STATIC_MATRIX_PRESERVED___transformationsMatrixToGlobal
= (new Model()).GetWorkPlaneHandler().GetCurrentTransformationPlane().TransformationMatrixToGlobal;
Script.public_static_Script_graphicsdrawer_at_starting=new GraphicsDrawer();
Script.public_static_Script_graphicsdrawer_at_starting.DrawText(new Point(0.0, 0.0, 0.0), "global_origin_starting", new Color(1.0, 0.5, 0.0));
Script.public_static_Script_graphicsdrawer_at_starting.DrawLineSegment(new Point(0.0, 0.0, 0.0), new Point(30000.0, 0.0, 0.0), Script.Red);
Script.public_static_Script_graphicsdrawer_at_starting.DrawLineSegment(new Point(0.0, 0.0, 0.0), new Point(0.0, 30000.0, 0.0), Script.Green);
Script.public_static_Script_graphicsdrawer_at_starting.DrawLineSegment(new Point(0.0, 0.0, 0.0), new Point(0.0, 0.0, 30000.0), Script.Blue);
Script.public_static_Script_graphicsdrawer_at_starting.DrawText(new Point(30000.0, 0.0, 0.0),"GLOBAL_X" ,Script.Red);
Script.public_static_Script_graphicsdrawer_at_starting.DrawText( new Point(0.0, 30000.0, 0.0),"GLOBAL_Y", Script.Green);
Script.public_static_Script_graphicsdrawer_at_starting.DrawText( new Point(0.0, 0.0, 30000.0),"GLOBAL_Z" , Script.Blue);
Script.PUBLIC_STATIC_PRESERVED_X_AXIS_GLOBAL_VECTOR=null;
Script.PUBLIC_STATIC_PRESERVED_Y_AXIS_GLOBAL_VECTOR=null;
Script.PUBLIC_STATIC_PRESERVED_Z_AXIS_GLOBAL_VECTOR=null;
Script.PUBLIC_STATIC_PRESERVED_X_AXIS_GLOBAL_VECTOR
=
new Vector(
3000,0,0
);
Script.PUBLIC_STATIC_PRESERVED_Y_AXIS_GLOBAL_VECTOR
=
new Vector(
0,3000,0
);
Script.PUBLIC_STATIC_PRESERVED_Z_AXIS_GLOBAL_VECTOR
=
new Vector(
0,0,3000
);
try
{
ShowCoordinateSystem.RunMacro(akit);
}
catch (Exception ex)
{
Trace.WriteLine(ex.InnerException + ex.Message + ex.StackTrace);
}
}
}
public static class ShowCoordinateSystem
{
/// <summary>
/// Length of each axis vector
/// </summary>
private const int VectorLength = 500;
public static Tekla.Structures.Model.TransformationPlane public_static_TO_GLOBAL_TRANSFORMATIONPLANE___PRESERVED;
public static System.Collections.Hashtable hashtable_of_strings_for_project_string_properties_from_fakeBeam_for_project_properties_with_ID_7;
public static System.Collections.Hashtable hashtable_of_strings_for_project_double_properties_from_fakeBeam_for_project_properties_with_ID_7;
public static System.Collections.Hashtable hashtable_of_strings_for_project_int_properties_from_fakeBeam_for_project_properties_with_ID_7;
//System.Collections..::..ArrayList
public static System.Collections.Hashtable hashtable_of_strings_for_CURRENT_BEAMS_REPORT_PROPERTIES;
public static bool PUBLIC_STATIC_BOOL_DO_YOU_NEED_THE_FILES_LOG_FOR_THE_COORDINATES_SYSTEMS_LOGGER=false;//true;//false;
public static bool PUBLIC_STATIC_BOOL_DO_YOU_NEED_THE_FILES_LOG_FOR_THE_EDGES=false;//true;//false;
public static bool PUBLIC_STATIC_BOOL_DO_YOU_NEED_THE_FILES_LOG_FOR_THE_faces_and_loops=false;
public static List<Part> PUBLIC_STATIC_LIST__OF___PARTS___WELDED___WITH___NEAR_SIDE_OBJECTS=new List<Part>();
public static List<int> PUBLIC_STATIC_LIST_OF_PARTS_WELDED_IDENTIFIERS_ID = new List<int>();
public static List<string> PUBLIC_STATIC_LIST_OF_PARTS_WELDED_IDENTIFIERS_GUID_STRINGS = new List<string>();
/// <summary>
/// Method that paints current coordinate system
/// </summary>
public static void RunMacro(IScript akit)
{
PUBLIC_STATIC_LIST__OF___PARTS___WELDED___WITH___NEAR_SIDE_OBJECTS.Clear();
PUBLIC_STATIC_LIST_OF_PARTS_WELDED_IDENTIFIERS_ID.Clear();
PUBLIC_STATIC_LIST_OF_PARTS_WELDED_IDENTIFIERS_GUID_STRINGS.Clear();
ModelObject pickedObject= PickObjectFromModel("CHOOSE THE OBJECT FOR NEAR SIDE TO EXPORT DXF");;
ModelObject pickedObject___for_front_view_setting = PickObjectFromModel("CHOOSE OBJECT FOR VIEW DIRECTIONS");
try
{
Tekla.Structures.Model.Model DETASYSDOTCOM_mo = new Tekla.Structures.Model.Model();
Tekla.Structures.Model.ModelInfo current_models_Info = DETASYSDOTCOM_mo.GetInfo();
Tekla.Structures.Model.TransformationPlane SAAN_GLOBAL_TRANSFORMATION_PLANE
=
public_static_TO_GLOBAL_TRANSFORMATIONPLANE___PRESERVED
=
DETASYSDOTCOM_mo.GetWorkPlaneHandler().GetCurrentTransformationPlane();;
//Get object from user
/// var pickedObject = PickObjectFromModel();
// ModelObject
// pickedObject = PickObjectFromModel("CHOOSE THE OBJECT FOR NEAR SIDE TO EXPORT DXF");
if (pickedObject == null)
{return;}
//pickedObject.Select();
// int get_integer_property_for_Depth = 600000;////// THIS IS DUMMY NOW
// int get_integer_property_for_TOTAL_NODES_IN_SOLIDS = 0;
// get_integer_property_for_TOTAL_NODES_IN_SOLIDS = (int)GetIntegerProperty(objectId);
// string get_string_property_For_Depth = "";
// string get_string_property_For_THE_MODEL_OBJECT_TYPES = "";
int selectedobjectID=pickedObject.Identifier.ID;
// public static int public_static_identifier_id_int_for_picked_object_to_draw_assembly=0;
// public static int public_static_identifier_id_int_for_picked_object_to_decide_front_view_and_top_view_in_dxf=0;
// public static int public_static_identifier_id_int_for_automatically_preserving_main_part_of_current_assembly=0;
Script.public_static_identifier_id_int_for_picked_object_to_draw_assembly=selectedobjectID;
///ModelObject pickedObject___for_front_view_setting = PickObjectFromModel("CHOOSE OBJECT FOR VIEW DIRECTIONS");
if (pickedObject___for_front_view_setting == null)
{
pickedObject___for_front_view_setting
=
pickedObject;
;
}//if (pickedObject___for_front_view_setting == null)
Script.public_static_identifier_id_int_for_picked_object_to_decide_front_view_and_top_view_in_dxf
=
pickedObject___for_front_view_setting.Identifier.ID;
// Script.PUBLIC_STATIC_PRESERVED_X_AXIS_GLOBAL_VECTOR=null;
// Script.PUBLIC_STATIC_PRESERVED_Y_AXIS_GLOBAL_VECTOR=null;
// Script.PUBLIC_STATIC_PRESERVED_Z_AXIS_GLOBAL_VECTOR=null;
Script.public_static_Script_graphicsdrawer_at_starting
.DrawText
(
pickedObject___for_front_view_setting
.GetCoordinateSystem().Origin
, "LOCALVIEWS_origin_starting"
, new Color(1.0, 0.5, 0.0)
);
Script.public_static_Script_graphicsdrawer_at_starting
.DrawLineSegment
(
pickedObject___for_front_view_setting
.GetCoordinateSystem().Origin
,
pickedObject___for_front_view_setting
.GetCoordinateSystem().Origin
+
Script.PUBLIC_STATIC_PRESERVED_X_AXIS_GLOBAL_VECTOR
, Script.Red
);
// // // Script.public_static_Script_graphicsdrawer_at_starting.DrawLineSegment(new Point(0.0, 0.0, 0.0), new Point(0.0, 30000.0, 0.0), Script.Green);
// // // Script.public_static_Script_graphicsdrawer_at_starting.DrawLineSegment(new Point(0.0, 0.0, 0.0), new Point(0.0, 0.0, 30000.0), Script.Blue);
Script.public_static_Script_graphicsdrawer_at_starting
.DrawLineSegment
(
pickedObject___for_front_view_setting
.GetCoordinateSystem().Origin
,
pickedObject___for_front_view_setting
.GetCoordinateSystem().Origin
+
Script.PUBLIC_STATIC_PRESERVED_Y_AXIS_GLOBAL_VECTOR
, Script.Green
);
Script.public_static_Script_graphicsdrawer_at_starting
.DrawLineSegment
(
pickedObject___for_front_view_setting
.GetCoordinateSystem().Origin
,
pickedObject___for_front_view_setting
.GetCoordinateSystem().Origin
+
Script.PUBLIC_STATIC_PRESERVED_Z_AXIS_GLOBAL_VECTOR
, Script.Blue
);
Script.public_static_Script_graphicsdrawer_at_starting
.DrawText
(
pickedObject___for_front_view_setting
.GetCoordinateSystem().Origin
+
Script.PUBLIC_STATIC_PRESERVED_X_AXIS_GLOBAL_VECTOR
,"ALONG GLOBAL_X"
,Script.Red
);
Script.public_static_Script_graphicsdrawer_at_starting
.DrawText
(
pickedObject___for_front_view_setting
.GetCoordinateSystem().Origin
+
Script.PUBLIC_STATIC_PRESERVED_Y_AXIS_GLOBAL_VECTOR
,"ALONG GLOBAL_Y"
,Script.Green
);
Script.public_static_Script_graphicsdrawer_at_starting
.DrawText
(
pickedObject___for_front_view_setting
.GetCoordinateSystem().Origin
+
Script.PUBLIC_STATIC_PRESERVED_Z_AXIS_GLOBAL_VECTOR
,"ALONG GLOBAL_z"
,Script.Blue
);
/////////////////////////////////////////////////////////////////////////////////////////////
Script.THE_Z_AXIS_AS_ROTOR_AXIS_VECTOR___AT_LOCAL_ORIGIN__AND_ALONG_GLOBAL_Z
=new Vector
(
(
pickedObject___for_front_view_setting
.GetCoordinateSystem().Origin
+
Script.PUBLIC_STATIC_PRESERVED_Z_AXIS_GLOBAL_VECTOR
).X
-
pickedObject___for_front_view_setting
.GetCoordinateSystem().Origin
.X
,
(
pickedObject___for_front_view_setting
.GetCoordinateSystem().Origin
+
Script.PUBLIC_STATIC_PRESERVED_Z_AXIS_GLOBAL_VECTOR
).Y
-
pickedObject___for_front_view_setting
.GetCoordinateSystem().Origin
.Y
,
(
pickedObject___for_front_view_setting
.GetCoordinateSystem().Origin
+
Script.PUBLIC_STATIC_PRESERVED_Z_AXIS_GLOBAL_VECTOR
).Z
-
pickedObject___for_front_view_setting
.GetCoordinateSystem().Origin
.Z
);
//////////////////////////////////////////////////////////////////////////////
// // // Script.public_static_Script_graphicsdrawer_at_starting.DrawText( new Point(0.0, 30000.0, 0.0),"GLOBAL_Y", Script.Green);
// // // Script.public_static_Script_graphicsdrawer_at_starting.DrawText( new Point(0.0, 0.0, 30000.0),"GLOBAL_Z" , Script.Blue);
Tekla.Structures.Model.ContourPlate _cp= pickedObject as Tekla.Structures.Model.ContourPlate;
Tekla.Structures.Model.BoltArray _bolt_array = pickedObject as Tekla.Structures.Model.BoltArray;
Tekla.Structures.Model.PolyBeam _polybeam= pickedObject as Tekla.Structures.Model.PolyBeam;
// if (_cp == null) return;
if (_cp == null)
{
Tekla.Structures.Model.Beam _sel_beam = pickedObject as Tekla.Structures.Model.Beam;
if (_sel_beam == null)
{
// System.Windows.Forms.MessageBox.Show("It is not contour plate nor a beam so I am going out from here");
// return;
// if (_cp == null) return;
if (!(_bolt_array == null))
{
//Tekla.Structures.Model.Bolt _sel_beam = pickedObject as Tekla.Structures.Model.Bolt;
if (_bolt_array == null)
{
System.Windows.Forms.MessageBox.Show("It is not contour plate nor a beam or bolt array so I am going out from here");
return;
}//if (_sel_beam == null)
}//if (!(_bolt_array == null))
}//if (_sel_beam == null)
}//if (_cp == null)
string text = string.Empty;
text = "30";
//TeklaStructures.Settings.GetAdvancedOption("XS_DEFAULT_FONT_SIZE", ref text);
//string[] lines = text.Split(new[] { ";" }, StringSplitOptions.None);
//foreach (string SOL_aa in lines)
//{
// if (SOL_aa.Contains("system") && !SOL_aa.Contains("common"))
// {
// string Env = SOL_aa.Substring(SOL_aa.IndexOf("environments") + ("environments").Length).Replace("system", "").Replace(@"\", "");
// }
//} //foreach (string SOL_aa in lines)
int _font_size = Convert.ToInt32(text);
//Setup coordinate system from object
/// var coordSys = pickedObject.GetCoordinateSystem();
var coordSys = pickedObject___for_front_view_setting.GetCoordinateSystem();
var xAxisEndPt = new Point(coordSys.Origin);
var yAxisEndPt = new Point(coordSys.Origin);
var zAxisEndPt = new Point(coordSys.Origin);
xAxisEndPt.Translate(RoundVector(coordSys.AxisX.GetNormal()) * VectorLength);
yAxisEndPt.Translate(RoundVector(coordSys.AxisY.GetNormal()) * VectorLength);
zAxisEndPt.Translate(RoundVector(Vector.Cross(coordSys.AxisX, coordSys.AxisY).GetNormal()) * VectorLength);
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
//ganda kam kiya Do_update_view();
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
//Paint axis of coordinate sytem
// var gd = new GraphicsDrawer();
Tekla.Structures.Model.UI.GraphicsDrawer gd = new GraphicsDrawer();
gd.DrawLineSegment(coordSys.Origin, xAxisEndPt, Red);
gd.DrawLineSegment(coordSys.Origin, yAxisEndPt, Green);
gd.DrawLineSegment(coordSys.Origin, zAxisEndPt, Blue);
//sol enhancements
gd.DrawText(coordSys.Origin, "SOL_ORIGIN=" + coordSys.Origin.ToString(), Red);
gd.DrawText(xAxisEndPt, "viewer_local_x", Red);
gd.DrawText(yAxisEndPt, "viewer_local_y", Green);
gd.DrawText(zAxisEndPt, "viewer_local_z", Blue);
////////////////////////////////////////////////////////////////////////////////////////
Script.THE_PROJECTIONS_VECTOR_OF_LOCAL_X_ON_GLOBAL___XY_PLANE_AT_LOCAL_ORIGIN
=new Vector
(
xAxisEndPt.X -coordSys.Origin.X
,
xAxisEndPt.Y -coordSys.Origin.Y
,
///xAxisEndPt.Z
0
////// this is the trick
);
////////////////////////////////////////////////////////////////////////////////////////
gd.DrawLineSegment
(
coordSys.Origin
,
coordSys.Origin
+
Script.THE_PROJECTIONS_VECTOR_OF_LOCAL_X_ON_GLOBAL___XY_PLANE_AT_LOCAL_ORIGIN
, new Color(0.01,0.01,0.01)
);
gd.DrawText
(
coordSys.Origin
+
Script.THE_PROJECTIONS_VECTOR_OF_LOCAL_X_ON_GLOBAL___XY_PLANE_AT_LOCAL_ORIGIN
, "VIEWER_X_PROJECTED_ON_GXY_PLANE_AT_LOCAL_Z"
, new Color(0.01,0.01,0.01)
);
double _temp_projections_length_found_for_local_projected_vector_on_gxy_to_global_xz
=
(Script.THE_PROJECTIONS_VECTOR_OF_LOCAL_X_ON_GLOBAL___XY_PLANE_AT_LOCAL_ORIGIN.GetNormal())
.Dot
(
Script.PUBLIC_STATIC_PRESERVED_X_AXIS_GLOBAL_VECTOR.GetNormal()
);
/////////////////////////////////////////////////////////////////////////////////////////////////
Script.ANGLE_OF_LOCAL_X_AXIS_ON_GLOBAL_XZ_FIRST_QUADRANT_GLOBAL_IN_RADIAN
=
Math.Acos
(
_temp_projections_length_found_for_local_projected_vector_on_gxy_to_global_xz
);
gd.DrawText
(
coordSys.Origin
+
Script.THE_PROJECTIONS_VECTOR_OF_LOCAL_X_ON_GLOBAL___XY_PLANE_AT_LOCAL_ORIGIN
*1.6
, "ANGLE WITH GXZ = " +
(Script.ANGLE_OF_LOCAL_X_AXIS_ON_GLOBAL_XZ_FIRST_QUADRANT_GLOBAL_IN_RADIAN*180/Math.PI).ToString()
, new Color(0.03,0.01,0.01)
);
// // // // Project the local vector onto the plane defined by axis1 and axis2
// // // Vector3 projection = Vector3.Dot(localVector, axis1) * axis1 + Vector3.Dot(localVector, axis2) * axis2;
// // // // Calculate the angle between the projection and axis1
// // // double angle = Math.Acos(Vector3.Dot(Vector3.Normalize(projection), axis1));
// // // // Ensure the angle is in the first quadrant
// // // if (Vector3.Dot(projection, axis2) < 0)
// // // {
// // // angle = 2 * Math.PI - angle;
// // // }//if (Vector3.Dot(projection, axis2) < 0)
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//this is done to do some special work for contour plates
if (!(_cp == null))
{
//doing object oriented khujli with contours
Tekla.Structures.Model.Contour _contour = _cp.Contour;
// TSG3D.Contour _contour = _cp.Contour;
System.Collections.ArrayList _contour_points_in_current_contour_plate = _contour.ContourPoints;
int counter = 0;
foreach (ContourPoint _iterating_contour_point in _contour_points_in_current_contour_plate)
{
if (counter == 0)
{
gd.DrawText(_iterating_contour_point+ _font_size*(new Vector(0,1,0)), "SOL_point=(" + counter.ToString() + ")" + coordSys.Origin.ToString(), Red);
}// if (counter == 0)
gd.DrawText(_iterating_contour_point, "SOL_point=("+ counter.ToString() +")" + coordSys.Origin.ToString(), Red);
counter++;
}//foreach(ContourPoint _iterating_contour_point in _contour_points_in_current_contour_plate)
}// if (!(_cp == null))
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
string report_for_bolts = "";
//this is done to do some special work for _bolt_array
if (!(_bolt_array == null))
{
//doing object oriented khujli with contours
report_for_bolts = report_for_bolts + "\r\n" + _bolt_array.PartToBeBolted.ToString();
report_for_bolts = report_for_bolts + "\r\n" + _bolt_array.PartToBoltTo.ToString();// = cp;
report_for_bolts = report_for_bolts + "\r\n" + _bolt_array.FirstPosition.ToString();// = new Point(3000, 6000, 0);
//_bolt_array.SecondPosition = new Point(6000, 12000, 0);
report_for_bolts = report_for_bolts + "\r\n" + _bolt_array.BoltSize.ToString();// = 16;
report_for_bolts = report_for_bolts + "\r\n" + _bolt_array.Tolerance.ToString();// = 3.00;
report_for_bolts = report_for_bolts + "\r\n" + _bolt_array.BoltStandard.ToString();// = "NELSON";
//_bolt_array.BoltType = BoltGroup.BoltTypeEnum.BOLT_TYPE_WORKSHOP;
//_bolt_array.CutLength = 105;
//_bolt_array.Length = 100;
//_bolt_array.ExtraLength = 15;
//_bolt_array.ThreadInMaterial = BoltGroup.BoltThreadInMaterialEnum.THREAD_IN_MATERIAL_NO;
//_bolt_array.Position.Depth = Position.DepthEnum.MIDDLE;
//_bolt_array.Position.Plane = Position.PlaneEnum.MIDDLE;
//_bolt_array.Position.Rotation = Position.RotationEnum.FRONT;
//_bolt_array.Bolt = true;
//_bolt_array.Washer1 = true;
//_bolt_array.Washer2 = true;
//_bolt_array.Washer3 = true;
//_bolt_array.Nut1 = true;
//_bolt_array.Nut2 = true;
//_bolt_array.Hole1 = true;
//_bolt_array.Hole2 = true;
//_bolt_array.Hole3 = true;
//_bolt_array.Hole4 = true;
//_bolt_array.Hole5 = true;
System.Windows.Forms.MessageBox.Show(report_for_bolts);
} // if (!(_bolt_array == null))
Script.public_static_identifier_id_int_for_automatically_preserving_main_part_of_current_assembly
=
//(Part)(((Part)(pickedObject as Part)).GetAssembly().GetMainPart() as Part).Identifier.ID;
((Part)(pickedObject as Part)).GetAssembly().GetMainPart().Identifier.ID;
DETASYSDOTCOM_mo.GetWorkPlaneHandler()
.SetCurrentTransformationPlane(public_static_TO_GLOBAL_TRANSFORMATIONPLANE___PRESERVED);
Script.public_static_To_Coordinate_system___public_static_identifier_id_int_for_picked_object_to_decide_front_view_and_top_view_in_dxf
=
pickedObject___for_front_view_setting.GetCoordinateSystem();
// // // Script.public_static_TransformationPlane___from___public_static_identifier_id_int_for_picked_object_to_decide_front_view_and_top_view_in_dxf
// // // =
// // // new TransformationPlane
// // // (
// // // //public_static_TO_GLOBAL_TRANSFORMATIONPLANE___PRESERVED.Origin
// // // new Point(0,0,0)
// // // ,
// // // pickedObject___for_front_view_setting.GetCoordinateSystem().AxisX
// // // ,
// // // pickedObject___for_front_view_setting.GetCoordinateSystem().AxisY
// // // );
System.Windows.Forms.MessageBox.Show
(
"selectedobjectID = " + selectedobjectID
+"\r\n"+
"view presetter objects ID for dxf= "
+
Script.public_static_identifier_id_int_for_picked_object_to_decide_front_view_and_top_view_in_dxf
+"\r\n"+
"main part ID = " +
Script.public_static_identifier_id_int_for_automatically_preserving_main_part_of_current_assembly
);
ModelObject modelObject_selected =
//thiss
//.model.
DETASYSDOTCOM_mo.SelectModelObject(new Identifier(selectedobjectID)) ;
Part ___selected_picked_part = (Part)(modelObject_selected as Part);
//System.Windows.Forms.MessageBox.Show("___selected_picked_part = " + ___selected_picked_part.ToString());
Tekla.Structures.Model.Assembly ___found_assembly_from_picked_object
=
//modelObject_selected.GetAssembly();
___selected_picked_part.GetAssembly();
ModelObjectEnumerator ___current_assembly_objects___modobjsenums
=
//___found_assembly_from_picked_object.GetChildren();
___found_assembly_from_picked_object.GetHierarchicObjects();
//GetHierarchicObjects()
//System.Windows.Forms.MessageBox.Show("___current_assembly_objects___modobjsenums GetSize() = " + ___current_assembly_objects___modobjsenums.GetSize().ToString());
int number_of_objects_in_current_assembly=___current_assembly_objects___modobjsenums.GetSize();
int number_of_subassemblies_objects_in_current_assembly=___found_assembly_from_picked_object.GetSubAssemblies().Count;
//System.Windows.Forms.MessageBox.Show("number_of_subassemblies_objects_in_current_assembly = " + number_of_subassemblies_objects_in_current_assembly);
//int number_of_connected_parts_with_main_part_objects_in_current_assembly
//=___found_assembly_from_picked_object.GetMainPart();
PUBLIC_STATIC_LIST__OF___PARTS___WELDED___WITH___NEAR_SIDE_OBJECTS
=
//////GetWeldedParts___WITH_FIRST_SELECTION___SAAN( (Part)(pickedObject as Part) , 1);
///GetWeldedPartsAtLevel( (Part)(pickedObject as Part) , 3);
//GetWeldedPartsAtLevel( (Part)(pickedObject as Part) , 2);
//GetWeldedPartsAtLevel( (Part)(pickedObject as Part) , 2);
///GetWeldedPartsAtLevel( (Part)(pickedObject as Part) , 1);
GetWeldedPartsAtLevel( (Part)(pickedObject as Part) , 1);
PUBLIC_STATIC_LIST__OF___PARTS___WELDED___WITH___NEAR_SIDE_OBJECTS
.AddRange
(
GetWeldedPartsAtLevel( (Part)(pickedObject___for_front_view_setting as Part) , 1)
);
System.Windows.Forms.MessageBox.Show("welded parts with the selected part count = "
+PUBLIC_STATIC_LIST__OF___PARTS___WELDED___WITH___NEAR_SIDE_OBJECTS
.Count);
////////////////////////////////////////////////////////////////////////////////////////////////////////
foreach(Part __prt_welded_with in PUBLIC_STATIC_LIST__OF___PARTS___WELDED___WITH___NEAR_SIDE_OBJECTS)
{
PUBLIC_STATIC_LIST_OF_PARTS_WELDED_IDENTIFIERS_ID
.Add(__prt_welded_with.Identifier.ID);
PUBLIC_STATIC_LIST_OF_PARTS_WELDED_IDENTIFIERS_GUID_STRINGS
.Add(__prt_welded_with.Identifier.GUID.ToString());
}//foreach(Part __prt_welded_with in PUBLIC_STATIC_LIST__OF___PARTS___WELDED___WITH___NEAR_SIDE_OBJECTS)
////////////////////////////////////////////////////////////////////////////////////////////////////////
////////PUBLIC_STATIC_LIST_OF_PARTS_WELDED_IDENTIFIERS_ID
ArrayList ___connectedobjects_arraylistofparts
=
///GetAssemblyParts___SAAN___modelobjects(( (Part)(pickedObject as Part) ).GetAssembly());
GetAssemblyParts___SAAN(( (Part)(pickedObject as Part) ).GetAssembly());
System.Windows.Forms.MessageBox.Show("___connectedobjects_arraylistofparts = " + ___connectedobjects_arraylistofparts.Count);
if(___connectedobjects_arraylistofparts.Count>0)
{
// // // foreach(Part _prtobjs_intheassembly in ___connectedobjects_arraylistofparts)
// // // {
// // // string ___report___get_string_property_For_THE_MODEL_OBJECT_TYPES
// // // =
// // // //Script.
// // // GetStringProperty(_prtobjs_intheassembly.Identifier.ID);//////////// yessssss this is getting the object
// // // }//foreach(Part _prtobjs_intheassembly in ___connectedobjects_arraylistofparts)
foreach(Identifier _prtobjs_intheassembly in ___connectedobjects_arraylistofparts)
{
string ___report___get_string_property_For_THE_MODEL_OBJECT_TYPES
=
//Script.
GetStringProperty(_prtobjs_intheassembly.ID);//////////// yessssss this is getting the object
}//foreach(Part _prtobjs_intheassembly in ___connectedobjects_arraylistofparts)
}//if(___connectedobjects_arraylistofparts.Count>0)
else if(number_of_objects_in_current_assembly>0)
{
foreach(ModelObject _temp_mod_object in ___current_assembly_objects___modobjsenums)
{
string ___report___get_string_property_For_THE_MODEL_OBJECT_TYPES
=
//Script.
GetStringProperty(_temp_mod_object.Identifier.ID);//////////// yessssss this is getting the object
}//foreach(ModelObject _temp_mod_object in ___current_assembly_objects___modobjsenums)
}//if(number_of_objects_in_current_assembly>0)
else if(number_of_subassemblies_objects_in_current_assembly>0)
{
}
else
{
string ___report___get_string_property_For_THE_MODEL_OBJECT_TYPES
=
// // // // // // //Script.
GetStringProperty(pickedObject.Identifier.ID);//////////// yessssss this is getting the object
Part ___mainPart= (Part)(( (Part)(pickedObject as Part) ).GetAssembly().GetMainPart() as Part);
string ___report___get_string_property_For_THE_MODEL_OBJECT_TYPES___main_part
=
// // // // // // //Script.
GetStringProperty(___mainPart.Identifier.ID);//////////// yessssss this is getting the object
}//end of else of if(number_of_objects_in_current_assembly>0)
// this was working finefor selectedobject only
// // // // // // string ___report___get_string_property_For_THE_MODEL_OBJECT_TYPES
// // // // // // =
// // // // // // //Script.
// // // // // // GetStringProperty(pickedObject.Identifier.ID);//////////// yessssss this is getting the object
}catch(Exception _excp_to_iterate_over_selected_objects_in_assembly)
{
System.Windows.Forms.MessageBox.Show("_excp_to_iterate_over_selected_objects_in_assembly = " + _excp_to_iterate_over_selected_objects_in_assembly.Message + " " + _excp_to_iterate_over_selected_objects_in_assembly.StackTrace.ToString());
}//catch(Exception _excp_to_iterate_over_selected_objects_in_assembly)
System.Windows.Forms.MessageBox.Show(" the solid drawing complete GetStringProperty\r\n\r\n\r\nNOW WE WILL DRAW COORDINATES AXES");
}// public static void RunMacro(IScript akit)
#region Model object child part fetching
/// public static void GetWeldedParts___WITH_FIRST_SELECTION___SAAN(Part part_SELECTED_FOR_NEAR_SIDES, List<Part> weldedParts, List<Part> partsToBeChecked)
public static List<Part> GetWeldedParts___WITH_FIRST_SELECTION___SAAN(Part part_SELECTED_FOR_NEAR_SIDES,int recursion_depth)
{
List<Part> Parts_attached_with_near_side_selected_part=new List<Part>();
Parts_attached_with_near_side_selected_part.Clear();
ModelObjectEnumerator welds_WITH_PART_SELECTED_WITH_NEAR_SIDES
= part_SELECTED_FOR_NEAR_SIDES.GetWelds();
while (welds_WITH_PART_SELECTED_WITH_NEAR_SIDES.MoveNext())
{
Weld current_iterated_weld = welds_WITH_PART_SELECTED_WITH_NEAR_SIDES.Current as Weld;
Part part___current_welds_main_object = null;//current_iterated_weld.MainObject as Part;
Part part___current_welds_seconds_object = null;//current_iterated_weld.SecondaryObject as Part;
if (current_iterated_weld != null)
{
part___current_welds_main_object =current_iterated_weld.MainObject as Part;
if(recursion_depth==1)
{
if (part___current_welds_main_object != null)
{
//Connection.AddPartToList(part2, weldedParts, partsToBeChecked);
Parts_attached_with_near_side_selected_part
.Add(part___current_welds_main_object);
}//if (part___current_welds_main_object != null)
part___current_welds_seconds_object=current_iterated_weld.SecondaryObject as Part;
if (part___current_welds_seconds_object != null)
{
part___current_welds_seconds_object = current_iterated_weld.SecondaryObject as Part;
//Connection.AddPartToList(part3, weldedParts, partsToBeChecked);
Parts_attached_with_near_side_selected_part
.Add(part___current_welds_seconds_object);
}//if (part___current_welds_seconds_object != null)
}
else if(recursion_depth==2)
{
ModelObjectEnumerator welds_WITH_SECOND_LEVEL_FOR_MAIN_WELDS_PART_SELECTED_WITH_NEAR_SIDES
= part___current_welds_main_object.GetWelds();
ModelObjectEnumerator welds_WITH_SECOND_LEVEL_FOR_SECONDARY_WELDS_PART_SELECTED_WITH_NEAR_SIDES
= part___current_welds_seconds_object.GetWelds();
// // // if (part___current_welds_main_object != null)
// // // {
// // // //Connection.AddPartToList(part2, weldedParts, partsToBeChecked);
// // // Parts_attached_with_near_side_selected_part
// // // .Add(part___current_welds_main_object);
// // // }//if (part___current_welds_main_object != null)
// // // part___current_welds_seconds_object = current_iterated_weld.SecondaryObject as Part;
// // // if (part___current_welds_seconds_object != null)
// // // {
// // // //Connection.AddPartToList(part3, weldedParts, partsToBeChecked);
// // // Parts_attached_with_near_side_selected_part
// // // .Add(part___current_welds_seconds_object);
// // // }//if (part___current_welds_seconds_object != null)
} //else if(recursion_depth==2)
} //if (current_iterated_weld != null)
} //while (welds_WITH_PART_SELECTED_WITH_NEAR_SIDES.MoveNext())
return Parts_attached_with_near_side_selected_part;
}// public static List<Part> GetWeldedParts___WITH_FIRST_SELECTION___SAAN(Part part_SELECTED_FOR_NEAR_SIDES)
public static List<Part> GetWeldedPartsAtLevel(Part part, int level)
{
List<Part> partsAtLevel = new List<Part>();
if (level < 1 || part == null)
{
return partsAtLevel;
}//if (level < 1 || part == null)
PopulateWeldedPartsAtLevel(part, level, 1, partsAtLevel);
return partsAtLevel;
}// public static List<Part> GetWeldedPartsAtLevel(Part part, int level)
private static void PopulateWeldedPartsAtLevel(Part part, int desiredLevel, int currentLevel, List<Part> partsAtLevel)
{
if (currentLevel == desiredLevel)
{
ModelObjectEnumerator welds = part.GetWelds();
while (welds.MoveNext())
{
Weld currentWeld = welds.Current as Weld;
if (currentWeld != null)
{
Part mainPart = currentWeld.MainObject as Part;
Part secondaryPart = currentWeld.SecondaryObject as Part;
if (mainPart != null && !partsAtLevel.Contains(mainPart))
{
partsAtLevel.Add(mainPart);
}//if (mainPart != null && !partsAtLevel.Contains(mainPart))
if (secondaryPart != null && !partsAtLevel.Contains(secondaryPart))
{
partsAtLevel.Add(secondaryPart);
}//if (secondaryPart != null && !partsAtLevel.Contains(secondaryPart))
}//if (currentWeld != null)
}// while (welds.MoveNext())
}
else
{
ModelObjectEnumerator welds = part.GetWelds();
while (welds.MoveNext())
{
Weld currentWeld = welds.Current as Weld;
if (currentWeld != null)
{
Part mainPart = currentWeld.MainObject as Part;
Part secondaryPart = currentWeld.SecondaryObject as Part;
if (mainPart != null)
{
PopulateWeldedPartsAtLevel(mainPart, desiredLevel, currentLevel + 1, partsAtLevel);
}//if (mainPart != null)
if (secondaryPart != null)
{
PopulateWeldedPartsAtLevel(secondaryPart, desiredLevel, currentLevel + 1, partsAtLevel);
}//if (secondaryPart != null)
}//if (currentWeld != null)
}//while (welds.MoveNext())
}//else if (currentLevel == desiredLevel)
} // private static void PopulateWeldedPartsAtLevel(Part part, int desiredLevel, int currentLevel, List<Part> partsAtLevel)
/// <summary>
/// Gets list of assembly parts
/// </summary>
/// <param name="SelectedModelObjects"></param>
/// <returns></returns>
public static ArrayList GetAssemblyParts___SAAN(Assembly assembly)
{
ArrayList Parts = new ArrayList();
IEnumerator AssemblyChildren = (assembly).GetSecondaries().GetEnumerator();
Parts.Add((assembly).GetMainPart().Identifier);
while(AssemblyChildren.MoveNext())
{
Parts.Add((AssemblyChildren.Current as Tekla.Structures.Model.ModelObject).Identifier);
}
return Parts;
}// private static ArrayList GetAssemblyParts___SAAN(Assembly assembly)
public static ArrayList GetAssemblyParts___SAAN___modelobjects(Assembly assembly)
{
ArrayList Parts = new ArrayList();
IEnumerator AssemblyChildren = (assembly).GetSecondaries().GetEnumerator();
Parts.Add((assembly).GetMainPart().Identifier);
while(AssemblyChildren.MoveNext())
{Parts.Add(AssemblyChildren.Current as Tekla.Structures.Model.ModelObject);}
return Parts;
}// private static ArrayList GetAssemblyParts___SAAN___modelobjects(Assembly assembly)
/// <summary>
/// Gets list of component parts
/// </summary>
/// <param name="SelectedModelObjects"></param>
/// <returns></returns>
public static ArrayList GetComponentParts___SAAN(BaseComponent component)
{
ArrayList Parts = new ArrayList();
IEnumerator myChildren = component.GetChildren();
while(myChildren.MoveNext())
{ Parts.Add((myChildren.Current as Tekla.Structures.Model.ModelObject).Identifier);}
return Parts;
}//private static ArrayList GetComponentParts___SAAN(BaseComponent component)
/// <summary>
/// Gets list of task parts
/// </summary>
/// <param name="TaskMembers"></param>
/// <returns></returns>
public static ArrayList GetTaskParts___SAAN(Task task)
{
ArrayList Parts = new ArrayList();
ModelObjectEnumerator myMembers = task.GetChildren();
while(myMembers.MoveNext())
{
if(myMembers.Current is Tekla.Structures.Model.Task)
{Parts.AddRange(GetTaskParts___SAAN(myMembers.Current as Tekla.Structures.Model.Task));}
else if(myMembers.Current is Tekla.Structures.Model.Part)
{ Parts.Add(myMembers.Current.Identifier);}
}// while(myMembers.MoveNext())
return Parts;
}// private static ArrayList GetTaskParts___SAAN(Task task)
#endregion
public static void Do_update_view()
{
// ViewHandler.SetRepresentation("standard");
ModelViewEnumerator ViewEnum = ViewHandler.GetAllViews();
while (ViewEnum.MoveNext())
{
View ViewSel = ViewEnum.Current;
ViewHandler.ShowView(ViewSel);
ViewHandler.RedrawView(ViewSel);
// ViewHandler.HideView(ViewSel);
}//while (ViewEnum.MoveNext())
}//public void Do_update_view()
/// <summary>
/// Gets single model object from model safely
/// </summary>
/// <param name="prompt">Prompt to show user</param>
/// <returns>Null if user interrupted</returns>
private static ModelObject PickObjectFromModel(string prompt )
{
try
{
string ___prompter="";
if(prompt=="")
{
___prompter= "Pick ANY object from model";
}
else
{
___prompter=prompt;
}
var picker = new Picker();
return picker.PickObject(Picker.PickObjectEnum.PICK_ONE_OBJECT, ___prompter);
}
catch (Exception ex)
{
if (ex.Message.ToLower().Contains("interrupt")) return null;
throw;
}
}
private static void Translate(this Point pt, Vector v)
{
pt.Translate(v.X, v.Y, v.Z);
}
public static Color Red { get { return new Color(1.0, 0.0, 0.0); } }
public static Color Blue { get { return new Color(0.0, 0.0, 1.0); } }
public static Color Green { get { return new Color(0.0, 1.0, 0.0); } }
/// <summary>
/// Rounds vector to five decimal places for each leg
/// </summary>
/// <param name="vector">Vector that needs rounding</param>
/// <returns>Resulting rounded vector</returns>
private static Vector RoundVector(Point vector)
{
var result = new Vector
{
X = Math.Round(vector.X, 5),
Y = Math.Round(vector.Y, 5),
Z = Math.Round(vector.Z, 5)
};
return result;
}//private static Vector RoundVector(Point vector)
public static string GetStringProperty(int objectId)
{
Tekla.Structures.Model.Model DETASYSDOTCOM_mo = new Tekla.Structures.Model.Model();
Tekla.Structures.Model.ModelInfo current_models_Info = DETASYSDOTCOM_mo.GetInfo();
// int get_integer_property_for_Depth = 600000;////// THIS IS DUMMY NOW
int get_integer_property_for_TOTAL_NODES_IN_SOLIDS = 0;
// get_integer_property_for_TOTAL_NODES_IN_SOLIDS = (int)GetIntegerProperty(objectId);
// string get_string_property_For_Depth = "";
string get_string_property_For_THE_MODEL_OBJECT_TYPES = "";
ModelObject modelObject =
//this
//.model.
DETASYSDOTCOM_mo.SelectModelObject(new Identifier(objectId));
int face_counter = 0;
int loop_counter = 0;
int vertex_counter = 0;
int edge_counter = 0;
//Tekla.Structures.Geometry3d.aabb
string CURRENT_MODEL_PATH = "";//current_models_Info.ModelPath
CURRENT_MODEL_PATH = current_models_Info.ModelPath.Replace("\\", "\\\\");
// // // // // // //this tricks sets the CURRENT TRANSFORMATION PLANE TO THE GLOBAL COORDINATES SYSTEMS
// // // // // // //this tricks sets the CURRENT TRANSFORMATION PLANE TO THE GLOBAL COORDINATES SYSTEMS
// // // // // // //this tricks sets the CURRENT TRANSFORMATION PLANE TO THE GLOBAL COORDINATES SYSTEMS
DETASYSDOTCOM_mo.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane());//this tricks sets the CURRENT TRANSFORMATION PLANE TO THE GLOBAL COORDINATES SYSTEMS
// // // // // // //RE CONNECTING TO THE CURRENT MODEL AND RE SETTING THE GLOBAL COORDINATES SYSTEMS FRESH
// // // // // // (new Model()).GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane());//this tricks sets the CURRENT TRANSFORMATION PLANE TO THE GLOBAL COORDINATES SYSTEMS
// // // // // // DETASYSDOTCOM_mo.CommitChanges();
// // // // // // /////////////////////////////////////////////// THIS ENFORCES THE MODELS CURRENT TRANSFORMATIONS PLANES TO THE GLOBAL COORDINATES SYSTEMS HERE ONWARDS //////////////////////////////////////
// // // // // // /////////////////////////////////////////////// THIS ENFORCES THE MODELS CURRENT TRANSFORMATIONS PLANES TO THE GLOBAL COORDINATES SYSTEMS HERE ONWARDS //////////////////////////////////////
// // // // // // /////////////////////////////////////////////// THIS ENFORCES THE MODELS CURRENT TRANSFORMATIONS PLANES TO THE GLOBAL COORDINATES SYSTEMS HERE ONWARDS //////////////////////////////////////
// // // // // // /////////////////////////////////////////////// THIS ENFORCES THE MODELS CURRENT TRANSFORMATIONS PLANES TO THE GLOBAL COORDINATES SYSTEMS HERE ONWARDS //////////////////////////////////////
// // // // // // /////////////////////////////////////////////// THIS ENFORCES THE MODELS CURRENT TRANSFORMATIONS PLANES TO THE GLOBAL COORDINATES SYSTEMS HERE ONWARDS //////////////////////////////////////
// // // // // // /////////////////////////////////////////////// THIS ENFORCES THE MODELS CURRENT TRANSFORMATIONS PLANES TO THE GLOBAL COORDINATES SYSTEMS HERE ONWARDS //////////////////////////////////////
// // // // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// // // // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// // // // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Tekla.Structures.Model.TransformationPlane SAAN_GLOBAL_TRANSFORMATION_PLANE
=
public_static_TO_GLOBAL_TRANSFORMATIONPLANE___PRESERVED
=
DETASYSDOTCOM_mo.GetWorkPlaneHandler().GetCurrentTransformationPlane();;
/// public static string CURRENT_PROJECT_NUMBER___FROM___DETASYSDOTCOM_ProjectInfo="";
/// public static string CURRENT_PROJECT_FARM_FOLDER_PATH___FROM___DETASYSDOTCOM_ProjectInfo="";
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Tekla.Structures.Model.Beam fakeBeam_for_project_properties_with_ID_7 = new Tekla.Structures.Model.Beam();
fakeBeam_for_project_properties_with_ID_7.Identifier.ID = 7; // ID of project(no need to insert this
//This helps to retrieve the project properties
hashtable_of_strings_for_project_string_properties_from_fakeBeam_for_project_properties_with_ID_7
=
new System.Collections.Hashtable();
System.Collections.Hashtable hashtable_of_strings_for_project_double_properties_from_fakeBeam_for_project_properties_with_ID_7
=
new System.Collections.Hashtable();
hashtable_of_strings_for_project_string_properties_from_fakeBeam_for_project_properties_with_ID_7.Clear();
System.Collections.Hashtable hashtable_of_strings_for_project_int_properties_from_fakeBeam_for_project_properties_with_ID_7
=
new System.Collections.Hashtable();
bool bool_succeed_to_read_string_properties_from_the______fakeBeam_for_project_properties_with_ID_7_GetStringUserProperties
=
fakeBeam_for_project_properties_with_ID_7.GetStringUserProperties (ref hashtable_of_strings_for_project_string_properties_from_fakeBeam_for_project_properties_with_ID_7);
bool bool_succeed_to_read_double_properties_from_the______fakeBeam_for_project_properties_with_ID_7_GetStringUserProperties
=
fakeBeam_for_project_properties_with_ID_7.GetDoubleUserProperties(ref hashtable_of_strings_for_project_double_properties_from_fakeBeam_for_project_properties_with_ID_7);
bool bool_succeed_to_read_int_properties_from_the______fakeBeam_for_project_properties_with_ID_7_GetStringUserProperties
=
fakeBeam_for_project_properties_with_ID_7.GetIntegerUserProperties(ref hashtable_of_strings_for_project_int_properties_from_fakeBeam_for_project_properties_with_ID_7);
//////string CURRENT_MODEL_PATH_SOL_ENGINEERING_REPORTS = CURRENT_MODEL_PATH + "\\\\SOL_ENGINEERING_REPORTS\\\\";
//////string CURRENT_MODELS_NORTH_DIRECTION_THETA = current_models_Info.NorthDirection;//this comes from the model info
//////_theta = CURRENT_MODELS_NORTH_DIRECTION_THETA;//_my_model_info.NorthDirection;
string CURRENT_MODEL_REPORT_PATH = CURRENT_MODEL_PATH + "\\Reports";
string CURRENT_MODEL_REPORT_PATH_FOR_SOLID_FILES___FOR_PROFILES_OBJECTS
=
CURRENT_MODEL_REPORT_PATH + "\\solids_report_from_SOL_TEKLA_TO_STAAD.PROFILES_OBJECTS";
string ___get_model_objects_report_property_POS_number = "";
try
{
//___get_model_objects_report_property_POS_number
modelObject
.GetReportProperty("PART_POS", ref ___get_model_objects_report_property_POS_number); //"PART_POS"
}
catch (Exception _excp_to_get_pos_number_for_model_object)
{
___get_model_objects_report_property_POS_number
=
(_excp_to_get_pos_number_for_model_object.Message + "_stack_trace_" + _excp_to_get_pos_number_for_model_object.StackTrace.ToString())
.Replace("\r\n", "_").Replace("\r", "_").Replace("\n", "_");
}//catch (Exception _excp_to_get_pos_number_for_model_object)
if(PUBLIC_STATIC_BOOL_DO_YOU_NEED_THE_FILES_LOG_FOR_THE_COORDINATES_SYSTEMS_LOGGER)
{
System.IO.File.AppendAllText
(
CURRENT_MODEL_REPORT_PATH_FOR_SOLID_FILES___FOR_PROFILES_OBJECTS
,
"\r\n"+
"modelObject TYPES FOUND = " + modelObject.GetType().ToString()
+
" modelObject_guid = " + modelObject.Identifier.GUID.ToString()
+
" ___get_model_objects_report_property_POS_number = " + ___get_model_objects_report_property_POS_number
+ " ModificationTime = " + modelObject.ModificationTime.ToString()
+ " IsUpToDate=" + modelObject.IsUpToDate.ToString()
);
} //if(PUBLIC_STATIC_BOOL_DO_YOU_NEED_THE_FILES_LOG_FOR_THE_COORDINATES_SYSTEMS_LOGGER)
try
{
// TAKEN TO START BECAUSE I NEED THE RECORDS OF ALL THE PROFILES FOR OBJECTS SELECTED
//////Tekla.Structures.Model.Model DETASYSDOTCOM_mo = new Tekla.Structures.Model.Model();
//////Tekla.Structures.Model.ModelInfo current_models_Info = DETASYSDOTCOM_mo.GetInfo();
Tekla.Structures.Geometry3d.Point ___current_main_part_origin = new Tekla.Structures.Geometry3d.Point(0, 0, 0);
Tekla.Structures.Geometry3d.Vector ___current_main_part_AxisX = new Tekla.Structures.Geometry3d.Vector(0, 0, 0);
Tekla.Structures.Geometry3d.Vector ___current_main_part_AxisY = new Tekla.Structures.Geometry3d.Vector(0, 0, 0);
Tekla.Structures.Geometry3d.Vector ___current_main_part_AxisZ = new Tekla.Structures.Geometry3d.Vector(0, 0, 0);
Tekla.Structures.Geometry3d.Point ___current_part_origin = new Tekla.Structures.Geometry3d.Point(0, 0, 0);
Tekla.Structures.Geometry3d.Vector ___current_part_AxisX = new Tekla.Structures.Geometry3d.Vector(0, 0, 0);
Tekla.Structures.Geometry3d.Vector ___current_part_AxisY = new Tekla.Structures.Geometry3d.Vector(0, 0, 0);
Tekla.Structures.Geometry3d.Vector ___current_part_AxisZ = new Tekla.Structures.Geometry3d.Vector(0, 0, 0);
Tekla.Structures.Geometry3d.Point ___assembly_front_view_origin = new Tekla.Structures.Geometry3d.Point(0, 0, 0);
Tekla.Structures.Geometry3d.Vector ___assembly_front_view_AxisX = new Tekla.Structures.Geometry3d.Vector(0, 0, 0);
Tekla.Structures.Geometry3d.Vector ___assembly_front_view_AxisY = new Tekla.Structures.Geometry3d.Vector(0, 0, 0);
Tekla.Structures.Geometry3d.Vector ___assembly_front_view_AxisZ = new Tekla.Structures.Geometry3d.Vector(0, 0, 0);
Tekla.Structures.Geometry3d.Point ___assembly_top_view_origin = new Tekla.Structures.Geometry3d.Point(0, 0, 0);
Tekla.Structures.Geometry3d.Vector ___assembly_top_view_AxisX = new Tekla.Structures.Geometry3d.Vector(0, 0, 0);
Tekla.Structures.Geometry3d.Vector ___assembly_top_view_AxisY = new Tekla.Structures.Geometry3d.Vector(0, 0, 0);
Tekla.Structures.Geometry3d.Vector ___assembly_top_view_AxisZ = new Tekla.Structures.Geometry3d.Vector(0, 0, 0);
// double ___angle_between_part_LX_to_Main_part_LX
//Tekla.Structures.Geometry3d.aabb
// string
CURRENT_MODEL_PATH = "";//current_models_Info.ModelPath
CURRENT_MODEL_PATH = current_models_Info.ModelPath.Replace("\\", "\\\\");
//////string CURRENT_MODEL_PATH_SOL_ENGINEERING_REPORTS = CURRENT_MODEL_PATH + "\\\\SOL_ENGINEERING_REPORTS\\\\";
//////string CURRENT_MODELS_NORTH_DIRECTION_THETA = current_models_Info.NorthDirection;//this comes from the model info
//////_theta = CURRENT_MODELS_NORTH_DIRECTION_THETA;//_my_model_info.NorthDirection;
// string
CURRENT_MODEL_REPORT_PATH = CURRENT_MODEL_PATH + "\\Reports";
string CURRENT_MODEL_REPORT_PATH_FOR_SOLID_FILES
=
CURRENT_MODEL_REPORT_PATH + "\\solids_report_from_SOL_TEKLA_TO_STAAD.SOLID";
/////////////////////////////////////////////////////////////////////////////////////////////
// CustomPropertyRAILSDXF.
//Script
//.
PUBLIC_STATIC_CLASS_FOR_SAAN_CALCULATIONS_OF_GEOMETRYS
.to_log_path______CURRENT_MODEL_REPORT_PATH_FOR_SOLID_FILES
= CURRENT_MODEL_REPORT_PATH_FOR_SOLID_FILES;
/////////////////////////////////////////////////////////////////////////////////////////////
//////////////// using System;
//////////////// using System.Collections;
//////////////// using System.Runtime.InteropServices;
//////////////// using Tekla.Structures.Geometry3d;
//////////////// using Tekla.Structures.Solid;
////////////////namespace Tekla.Structures.Model
//////////////// {
//////////////// [ClassInterface(ClassInterfaceType.AutoDual)]
//////////////// [Guid("BACF6178-2B10-4A1A-BB5C-E9EE2BAF7149")]
//////////////// public sealed class Solid : ISolid
//////////////// {
//////////////// public Point MinimumPoint { get; }
//////////////// public Point MaximumPoint { get; }
//////////////// public IEnumerator GetAllIntersectionPoints(Point point1, Point point2, Point point3);
//////////////// public ShellEnumerator GetCutPart(Solid CuttingPart);
//////////////// public EdgeEnumerator GetEdgeEnumerator();
//////////////// public FaceEnumerator GetFaceEnumerator();
//////////////// public ArrayList Intersect(LineSegment line);
//////////////// public ArrayList Intersect(Point point1, Point point2);
//////////////// [Obsolete("Intersect is deprecated, please use IntersectAllFaces instead.")]
//////////////// public ArrayList Intersect(Point point1, Point point2, Point point3);
//////////////// public IEnumerator IntersectAllFaces(Point point1, Point point2, Point point3);
//////////////// public enum SolidCreationTypeEnum
//////////////// {
//////////////// RAW = 0,
//////////////// FITTED = 1,
//////////////// NORMAL = 2,
//////////////// HIGH_ACCURACY = 3,
//////////////// PLANECUTTED = 4,
//////////////// NORMAL_WITHOUT_EDGECHAMFERS = 5,
//////////////// NORMAL_WITHOUT_WELDPREPS = 6
//////////////// }//public enum SolidCreationTypeEnum
//////////////// }// public sealed class Solid : ISolid
//////////////// }//namespace Tekla.Structures.Model
//////Solid solidRaw = myPart.GetSolid(Solid.SolidCreationTypeEnum.RAW);
//////Solid solidNormal = myPart.GetSolid(Solid.SolidCreationTypeEnum.NORMAL);
//////ShellEnumerator shells = solidRaw.GetCutPart(solidNormal);
//////int shellCount = 0;
//////List<int> faceCounts = new List<int>();
//////while (shells.MoveNext())
////// {
////// var shell = shells.Current as Shell;
////// if (shell != null)
////// {
////// FaceEnumerator faces = shell.GetFaceEnumerator();
////// faceCounts.Insert(shellCount, 0);
////// while (faces.MoveNext())
////// {
////// faceCounts[shellCount]++;
////// }
////// }
////// shellCount++;
////// }
//////https://forum.tekla.com/topic/32142-polygon-cut/#comment-149977
///
////// https://forum.tekla.com/topic/29987-wrong-clash-box-when-object-is-at-an-angle/#comment-140778
//////ShellEnumerator shells = object1.GetSolid(Solid.SolidCreationTypeEnum.HIGH_ACCURACY).GetCutPart(object2.GetSolid(Solid.SolidCreationTypeEnum.HIGH_ACCURACY));
//////int countFaces = 0;
//////while ((shells.MoveNext()) && shells.Current is Shell currentShell)
////// {
////// FaceEnumerator faceEnum = currentShell.GetFaceEnumerator();
////// while (faceEnum.MoveNext())
////// {
////// countFaces++;
////// }
////// }
//////if (countFaces > 6)
////// {
////// //there is really a clash
////// }
try
{
/// Beam MyPart = new Beam();
///
Part MyPart = ( (Part)modelObject as Part);
ArrayList MyList = new ArrayList();
ArrayList MyFaceNormalList = new ArrayList();
Tekla.Structures.Geometry3d.Point TO_LOG_PROJECTED_START_POINT_ON_FRONT_VIEW___AFTER_TRANSFORMATIONS
= new Tekla.Structures.Geometry3d.Point(-638, -638, -638);
Tekla.Structures.Geometry3d.Point TO_LOG_PROJECTED_FINAL_POINT_ON_FRONT_VIEW___AFTER_TRANSFORMATIONS
= new Tekla.Structures.Geometry3d.Point(-638, -638, -638);
Tekla.Structures.Geometry3d.Point TO_LOG_PROJECTED_START_POINT_ON_TOP_VIEW___AFTER_TRANSFORMATIONS
= new Tekla.Structures.Geometry3d.Point(-638, -638, -638);
Tekla.Structures.Geometry3d.Point TO_LOG_PROJECTED_FINAL_POINT_ON_TOP_VIEW___AFTER_TRANSFORMATIONS
= new Tekla.Structures.Geometry3d.Point(-638, -638, -638);
Tekla.Structures.Geometry3d.Point TO_LOG_PROJECTED_FACE_LOOP_POINT_ON_FRONT_VIEW___AFTER_TRANSFORMATIONS
= new Tekla.Structures.Geometry3d.Point(-638, -638, -638);
Tekla.Structures.Geometry3d.Point TO_LOG_PROJECTED_FACE_LOOP_POINT_ON_TOP_VIEW___AFTER_TRANSFORMATIONS
= new Tekla.Structures.Geometry3d.Point(-638, -638, -638);
//this.AxisX.Cross(this.AxisY);
___current_main_part_origin = ((Part)MyPart.GetAssembly().GetMainPart() as Part).GetCoordinateSystem().Origin;
___current_main_part_AxisX = ((Part)MyPart.GetAssembly().GetMainPart() as Part).GetCoordinateSystem().AxisX;
___current_main_part_AxisY = ((Part)MyPart.GetAssembly().GetMainPart() as Part).GetCoordinateSystem().AxisY;
___current_main_part_AxisZ = ((Part)MyPart.GetAssembly().GetMainPart() as Part).GetCoordinateSystem().AxisX.Cross(MyPart.GetAssembly().GetMainPart().GetCoordinateSystem().AxisY);
___current_part_origin = MyPart.GetCoordinateSystem().Origin;
___current_part_AxisX = MyPart.GetCoordinateSystem().AxisX;
___current_part_AxisY = MyPart.GetCoordinateSystem().AxisY;
___current_part_AxisZ = MyPart.GetCoordinateSystem().AxisX.Cross(MyPart.GetCoordinateSystem().AxisY);
___assembly_front_view_origin = ___current_main_part_origin;
___assembly_front_view_AxisX = ___current_main_part_AxisX;
___assembly_front_view_AxisY = ___current_main_part_AxisY;
___assembly_front_view_AxisZ = ___current_main_part_AxisZ;
___assembly_top_view_origin = ___current_main_part_origin;
___assembly_top_view_AxisX = ___current_main_part_AxisX;
___assembly_top_view_AxisY = ___current_main_part_AxisZ;//////tricks is here
___assembly_top_view_AxisZ = ___assembly_top_view_AxisX.Cross(___assembly_top_view_AxisY);
//////Tekla.Structures.Geometry3d.Point TO_LOG_PROJECTED_POINT_ON_FRONT_VIEW___AFTER_TRANSFORMATIONS
////// = new Tekla.Structures.Geometry3d.Point(-638, -638, -638);
//////Tekla.Structures.Geometry3d.Point TO_LOG_PROJECTED_POINT_ON_TOP_VIEW___AFTER_TRANSFORMATIONS
////// = new Tekla.Structures.Geometry3d.Point(-638, -638, -638);
////// i have used high accuracy now
// Solid Solid = MyPart.GetSolid(Solid.SolidCreationTypeEnum.HIGH_ACCURACY);
ISolid Solid = MyPart.GetSolid();
FaceEnumerator MyFaceEnum = Solid.GetFaceEnumerator();
EdgeEnumerator MyEdgeEnums= Solid.GetEdgeEnumerator();
Tekla.Structures.Model.UI.GraphicsDrawer gd___for_rails_dxf = new GraphicsDrawer();
WorkPlaneHandler myWorkPlaneHandler=DETASYSDOTCOM_mo.GetWorkPlaneHandler();
TransformationPlane currentPlane = myWorkPlaneHandler.GetCurrentTransformationPlane();
TransformationPlane CurrentMainPartPlane = new TransformationPlane(MyPart.GetAssembly().GetMainPart().GetCoordinateSystem());
CoordinateSystem CurrentselectedobjectPartCoordinateSystem=MyPart.GetCoordinateSystem();
CoordinateSystem CurrentMainPartCoordinateSystem=MyPart.GetAssembly().GetMainPart().GetCoordinateSystem();
CoordinateSystem CurrentAssemblyCoordinateSystem=MyPart.GetAssembly().GetCoordinateSystem();
CoordinateSystem CurrentAssemblyGetMainObjectCoordinateSystem=MyPart.GetAssembly().GetMainObject().GetCoordinateSystem();
// // // System.Windows.Forms.MessageBox.Show
// // // (
// // // "CurrentselectedobjectPartCoordinateSystem\r\n"
// // // +
// // // CurrentselectedobjectPartCoordinateSystem.Origin.ToString()+ " " + CurrentselectedobjectPartCoordinateSystem.AxisX.ToString() + " " + CurrentselectedobjectPartCoordinateSystem.AxisY.ToString()
// // // + "\r\n" +
// // // "MainPartCoordinateSystem\r\n"
// // // +
// // // CurrentMainPartCoordinateSystem.Origin.ToString()+ " " + CurrentMainPartCoordinateSystem.AxisX.ToString() + " " + CurrentMainPartCoordinateSystem.AxisY.ToString()
// // // + "\r\n" +
// // // "CurrentAssemblyGetMainObjectCoordinateSystem\r\n"
// // // +
// // // CurrentAssemblyGetMainObjectCoordinateSystem.Origin.ToString()+ " " + CurrentAssemblyGetMainObjectCoordinateSystem.AxisX.ToString() + " " + CurrentAssemblyGetMainObjectCoordinateSystem.AxisY.ToString()
// // // + "\r\n" +
// // // "CurrentAssemblyCoordinateSystem\r\n"
// // // +
// // // CurrentAssemblyCoordinateSystem.Origin.ToString()+ " " + CurrentAssemblyCoordinateSystem.AxisX.ToString() + " " + CurrentAssemblyCoordinateSystem.AxisY.ToString()
// // // );
// OBB _TEMP_OBB = null;
Tekla.Structures.Geometry3d.Point[] ___the_8_vertices_array_for___OBB = { };
/// while doing the auto connections we did the experiments
/// starts side anticlock points are 0,4,7,3,0
/// final sides anticlock points are 1,5,6,2,1
/// top surface has anticlock points are 3,7,6,2,3
/// bottom surface has anticlock points are 0,4,5,1,0
try
{
////////////////////////// this is tricky thing /////////////////
///////////////////////////// this is tricky thing /////////////////
///////////////////////////// this is tricky thing /////////////////
/// this is in the Numers
////// V7-------- V6
////// /| / |
////// V4-------- V5 |
//////| | | |
//////| |V3---- -| -V2
//////|/ | /
//////V0-------- V1
//in Tekla.Structures.Geometry2d.OBB
//start side is facing this side
////// V2-------- V6
////// /| / |
////// V3-------- V7 |
//////| | | |
//////| |V1---- -| -V3++
//////|/ | /
//////V0-------- V3+
// // // _TEMP_OBB =
// // // //CustomPropertyRAILDXF
// // // .
// // // //PublicStaticClassForAll_8_points_of_OBB_Object
// // // .SAAN_CALCULATE_ALL_OBB_OBJECTS_FOR_CURRENT_OBJECT(modelObject);
// // // ___the_8_vertices_array_for___OBB
// // // = _TEMP_OBB.ComputeVertices();
//////return_result =
////// _TEMP_OBB.ComputeVertices()[0].X;
////////////////////////// this is tricky thing /////////////////
///////////////////////////// this is tricky thing /////////////////
///////////////////////////// this is tricky thing /////////////////
///
}
catch (Exception ___excp_to_get_OBB_for_the_objects)
{
}//catch(Exception ___excp_to_get_OBB_for_the_objects)
/// other things dont have the edge enumerators
/// only the solids directly have the edges enumerators
///
while (MyEdgeEnums.MoveNext())
{
Edge MyEdge = MyEdgeEnums.Current as Edge;
/// Edges are directly under solids and not under faces nor under loops
if(MyEdge!=null)
{
//////public enum EdgeTypeEnum
////// {
////// EDGE_TYPE_NORMAL = 0,
////// EDGE_TYPE_CURVED_SURFACE = 1,
////// EDGE_TYPE_HIDDEN = 2
////// }
edge_counter++;
Tekla.Structures.Solid.Edge.EdgeTypeEnum MyEdgeType_EdgeTypeEnum_int_or_string;
MyEdgeType_EdgeTypeEnum_int_or_string = MyEdge.Type;
// // // if(MyEdgeType_EdgeTypeEnum_int_or_string.ToString()=="EDGE_TYPE_HIDDEN")
// // // {
// // // System.Windows.Forms.MessageBox.Show("MyEdgeType_EdgeTypeEnum_int_or_string = " + MyEdgeType_EdgeTypeEnum_int_or_string);
// // // }//if(MyEdgeType_EdgeTypeEnum_int_or_string=="EDGE_TYPE_HIDDEN")
// // // ////// MyEdge.Type
// // // if(MyEdge.Type==Tekla.Structures.Solid.Edge.EdgeTypeEnum.EDGE_TYPE_HIDDEN)
// // // {
// // // System.Windows.Forms.MessageBox.Show("MyEdgeType_EdgeTypeEnum_int_or_string = " + MyEdgeType_EdgeTypeEnum_int_or_string);
// // // }//if(MyEdgeType_EdgeTypeEnum_int_or_string=="EDGE_TYPE_HIDDEN")
//////System.IO.File.AppendAllText
////// (CURRENT_MODEL_REPORT_PATH_FOR_SOLID_FILES, "\r\nPART_GUID=" + MyPart.Identifier.GUID.ToString() + " PROFILES= " + MyPart.Profile.ProfileString.ToString() + " Assembly_GUID_is_main_part_guid= " + MyPart.GetAssembly().GetMainPart().Identifier.GUID.ToString() + " " + " PART_POS_NUMBER = " + MyPart.GetPartMark().ToString() + " MAIN_PART_POS_NUMBER = " + ((Part)MyPart.GetAssembly().GetMainPart() as Part).GetPartMark().ToString() + " PART_NAME= " + MyPart.Name + " edge_counter = " + edge_counter.ToString() + " Edge_Start_point = " + MyEdge.StartPoint.ToString().Replace(",","_") + " Edge_End_point = " + MyEdge.EndPoint.ToString().Replace(",", "_") + " Edge_Type = " + MyEdge.Type.ToString()+ " MyEdgeType_EdgeTypeEnum_int_or_string = " + MyEdgeType_EdgeTypeEnum_int_or_string + " MAIN_PART__coordinates_systems_CS_origin = " + MyPart.GetAssembly().GetMainPart().GetCoordinateSystem().Origin.ToString() + " MAIN_PART_CS_X_AXIS = " + MyPart.GetAssembly().GetMainPart().GetCoordinateSystem().AxisX.ToString() + " MAIN_PART_CS_Y_AXIS = " + MyPart.GetAssembly().GetMainPart().GetCoordinateSystem().AxisY.ToString() + " date = " + System.DateTime.Now.ToString());
//////FOR REFERENCES ___assembly_front_view_origin = ___current_main_part_origin;
//////FOR REFERENCES ___assembly_front_view_AxisX = ___current_main_part_AxisX;
//////FOR REFERENCES ___assembly_front_view_AxisY = ___current_main_part_AxisY;
//////FOR REFERENCES ___assembly_front_view_AxisZ = ___current_main_part_AxisZ;
//////FOR REFERENCES ___assembly_top_view_origin = ___current_main_part_origin;
//////FOR REFERENCES ___assembly_top_view_AxisX = ___current_main_part_AxisX;
//////FOR REFERENCES ___assembly_top_view_AxisY = ___current_main_part_AxisZ;//////tricks is here
//////FOR REFERENCES ___assembly_top_view_AxisZ = ___assembly_top_view_AxisX.Cross(___assembly_top_view_AxisY);
TO_LOG_PROJECTED_START_POINT_ON_FRONT_VIEW___AFTER_TRANSFORMATIONS
=
//CustomPropertyRAILSDXF.
PUBLIC_STATIC_CLASS_FOR_SAAN_CALCULATIONS_OF_GEOMETRYS
.GetProjectedPoint
(
MyEdge.StartPoint
,
___assembly_front_view_origin
,
___assembly_front_view_AxisX
,
___assembly_front_view_AxisY
,
___assembly_front_view_AxisZ
);
TO_LOG_PROJECTED_FINAL_POINT_ON_FRONT_VIEW___AFTER_TRANSFORMATIONS
=
// CustomPropertyRAILSDXF.
PUBLIC_STATIC_CLASS_FOR_SAAN_CALCULATIONS_OF_GEOMETRYS
.GetProjectedPoint
(
MyEdge.EndPoint
,
___assembly_front_view_origin
,
___assembly_front_view_AxisX
,
___assembly_front_view_AxisY
,
___assembly_front_view_AxisZ
);
TO_LOG_PROJECTED_START_POINT_ON_TOP_VIEW___AFTER_TRANSFORMATIONS
=
// CustomPropertyRAILSDXF.
PUBLIC_STATIC_CLASS_FOR_SAAN_CALCULATIONS_OF_GEOMETRYS
.GetProjectedPoint
(
MyEdge.StartPoint
,
___assembly_top_view_origin
,
___assembly_top_view_AxisX
,
___assembly_top_view_AxisY
,
___assembly_top_view_AxisZ
);
TO_LOG_PROJECTED_FINAL_POINT_ON_TOP_VIEW___AFTER_TRANSFORMATIONS
=
// CustomPropertyRAILSDXF.
PUBLIC_STATIC_CLASS_FOR_SAAN_CALCULATIONS_OF_GEOMETRYS
.GetProjectedPoint
(
MyEdge.EndPoint
,
___assembly_top_view_origin
,
___assembly_top_view_AxisX
,
___assembly_top_view_AxisY
,
___assembly_top_view_AxisZ
);
if(PUBLIC_STATIC_BOOL_DO_YOU_NEED_THE_FILES_LOG_FOR_THE_COORDINATES_SYSTEMS_LOGGER)
{
System.IO.File.AppendAllText
(
CURRENT_MODEL_REPORT_PATH_FOR_SOLID_FILES+"_coordsys.log",
"\r\nCurrentselectedobjectPartCoordinateSystem\r\n"
+
CurrentselectedobjectPartCoordinateSystem.Origin.ToString()+ " " + CurrentselectedobjectPartCoordinateSystem.AxisX.ToString() + " " + CurrentselectedobjectPartCoordinateSystem.AxisY.ToString()
+ "\r\n" +
"MainPartCoordinateSystem\r\n"
+
CurrentMainPartCoordinateSystem.Origin.ToString()+ " " + CurrentMainPartCoordinateSystem.AxisX.ToString() + " " + CurrentMainPartCoordinateSystem.AxisY.ToString()
+ "\r\n" +
"CurrentAssemblyGetMainObjectCoordinateSystem\r\n"
+
CurrentAssemblyGetMainObjectCoordinateSystem.Origin.ToString()+ " " + CurrentAssemblyGetMainObjectCoordinateSystem.AxisX.ToString() + " " + CurrentAssemblyGetMainObjectCoordinateSystem.AxisY.ToString()
+ "\r\n" +
"CurrentAssemblyCoordinateSystem\r\n"
+
CurrentAssemblyCoordinateSystem.Origin.ToString()+ " " + CurrentAssemblyCoordinateSystem.AxisX.ToString() + " " + CurrentAssemblyCoordinateSystem.AxisY.ToString()
);
}//if(PUBLIC_STATIC_BOOL_DO_YOU_NEED_THE_FILES_LOG_FOR_THE_COORDINATES_SYSTEMS_LOGGER)
//public static bool PUBLIC_STATIC_BOOL_DO_YOU_NEED_THE_FILES_LOG_FOR_THE_EDGES=false;
//public static bool PUBLIC_STATIC_BOOL_DO_YOU_NEED_THE_FILES_LOG_FOR_THE_faces_and_loops=false;
//experimenting
//myWorkPlaneHandler.SetCurrentTransformationPlane(CurrentMainPartPlane);
/// checked that it draws exactly 3000 mm towards x along global planes
myWorkPlaneHandler.SetCurrentTransformationPlane(public_static_TO_GLOBAL_TRANSFORMATIONPLANE___PRESERVED);
// could not find the constructions
///myWorkPlaneHandler.SetCurrentTransformationPlane(CurrentMainPartPlane);
// // // Point Transformed___TO_LOG_PROJECTED_START_POINT_ON_FRONT_VIEW___AFTER_TRANSFORMATIONS = CurrentPartPlane.TransformationMatrixToLocal.Transform(currentPlane.TransformationMatrixToGlobal.Transform(TO_LOG_PROJECTED_START_POINT_ON_FRONT_VIEW___AFTER_TRANSFORMATIONS));
// // // Point Transformed___TO_LOG_PROJECTED_FINAL_POINT_ON_FRONT_VIEW___AFTER_TRANSFORMATIONS = CurrentPartPlane.TransformationMatrixToLocal.Transform(currentPlane.TransformationMatrixToGlobal.Transform(TO_LOG_PROJECTED_FINAL_POINT_ON_FRONT_VIEW___AFTER_TRANSFORMATIONS));
// // // Point Transformed___TO_LOG_PROJECTED_START_POINT_ON_TOP_VIEW___AFTER_TRANSFORMATIONS = CurrentPartPlane.TransformationMatrixToLocal.Transform(currentPlane.TransformationMatrixToGlobal.Transform(TO_LOG_PROJECTED_START_POINT_ON_TOP_VIEW___AFTER_TRANSFORMATIONS));
// // // Point Transformed___TO_LOG_PROJECTED_FINAL_POINT_ON_TOP_VIEW___AFTER_TRANSFORMATIONS = CurrentPartPlane.TransformationMatrixToLocal.Transform(currentPlane.TransformationMatrixToGlobal.Transform(TO_LOG_PROJECTED_FINAL_POINT_ON_TOP_VIEW___AFTER_TRANSFORMATIONS));
// // // Point Transformed___TO_LOG_PROJECTED_START_POINT_ON_FRONT_VIEW___AFTER_TRANSFORMATIONS = CurrentMainPartPlane.TransformationMatrixToLocal.Transform(currentPlane.TransformationMatrixToGlobal.Transform(MyEdge.StartPoint));
// // // Point Transformed___TO_LOG_PROJECTED_FINAL_POINT_ON_FRONT_VIEW___AFTER_TRANSFORMATIONS = CurrentMainPartPlane.TransformationMatrixToLocal.Transform(currentPlane.TransformationMatrixToGlobal.Transform(MyEdge.EndPoint));
// // // Point Transformed___TO_LOG_PROJECTED_START_POINT_ON_TOP_VIEW___AFTER_TRANSFORMATIONS = CurrentMainPartPlane.TransformationMatrixToLocal.Transform(currentPlane.TransformationMatrixToGlobal.Transform(MyEdge.StartPoint));
// // // Point Transformed___TO_LOG_PROJECTED_FINAL_POINT_ON_TOP_VIEW___AFTER_TRANSFORMATIONS = CurrentMainPartPlane.TransformationMatrixToLocal.Transform(currentPlane.TransformationMatrixToGlobal.Transform(MyEdge.EndPoint));
// // // Point Transformed___TO_LOG_PROJECTED_START_POINT_ON_FRONT_VIEW___AFTER_TRANSFORMATIONS = CurrentMainPartPlane.TransformationMatrixToLocal.Transform(currentPlane.TransformationMatrixToLocal.Transform(MyEdge.StartPoint));
// // // Point Transformed___TO_LOG_PROJECTED_FINAL_POINT_ON_FRONT_VIEW___AFTER_TRANSFORMATIONS = CurrentMainPartPlane.TransformationMatrixToLocal.Transform(currentPlane.TransformationMatrixToLocal.Transform(MyEdge.EndPoint));
// // // Point Transformed___TO_LOG_PROJECTED_START_POINT_ON_TOP_VIEW___AFTER_TRANSFORMATIONS = CurrentMainPartPlane.TransformationMatrixToLocal.Transform(currentPlane.TransformationMatrixToLocal.Transform(MyEdge.StartPoint));
// // // Point Transformed___TO_LOG_PROJECTED_FINAL_POINT_ON_TOP_VIEW___AFTER_TRANSFORMATIONS = CurrentMainPartPlane.TransformationMatrixToLocal.Transform(currentPlane.TransformationMatrixToLocal.Transform(MyEdge.EndPoint));
// gd___for_rails_dxf.DrawLineSegment(Transformed___TO_LOG_PROJECTED_START_POINT_ON_FRONT_VIEW___AFTER_TRANSFORMATIONS, Transformed___TO_LOG_PROJECTED_FINAL_POINT_ON_FRONT_VIEW___AFTER_TRANSFORMATIONS, Red);
// gd___for_rails_dxf.DrawLineSegment(Transformed___TO_LOG_PROJECTED_START_POINT_ON_TOP_VIEW___AFTER_TRANSFORMATIONS, Transformed___TO_LOG_PROJECTED_FINAL_POINT_ON_TOP_VIEW___AFTER_TRANSFORMATIONS, Blue);
// Point shifted_start_3000_x_wise=new Point(MyEdge.StartPoint.X+3000 , MyEdge.StartPoint.Y , MyEdge.StartPoint.Z);
// Point shifted_final_3000_x_wise=new Point(MyEdge.EndPoint.X+3000 , MyEdge.EndPoint.Y , MyEdge.EndPoint.Z);
// gd___for_rails_dxf.DrawLineSegment(shifted_start_3000_x_wise,shifted_final_3000_x_wise,Blue);
// // // Point shifted_start_global_origin=new Point(MyEdge.StartPoint.X - CurrentMainPartCoordinateSystem.Origin.X , MyEdge.StartPoint.Y - CurrentMainPartCoordinateSystem.Origin.Y, MyEdge.StartPoint.Z- CurrentMainPartCoordinateSystem.Origin.Z);
// // // Point shifted_final_global_origin=new Point(MyEdge.EndPoint.X- CurrentMainPartCoordinateSystem.Origin.X , MyEdge.EndPoint.Y- CurrentMainPartCoordinateSystem.Origin.Y , MyEdge.EndPoint.Z- CurrentMainPartCoordinateSystem.Origin.Z);
// // // myWorkPlaneHandler.SetCurrentTransformationPlane
// // // (
// // // Script.public_static_TransformationPlane___from___public_static_identifier_id_int_for_picked_object_to_decide_front_view_and_top_view_in_dxf
// // // );
// // // Matrix ToLocal
// // // = MatrixFactory.ToCoordinateSystem
// // // (
// // // Script.public_static_To_Coordinate_system___public_static_identifier_id_int_for_picked_object_to_decide_front_view_and_top_view_in_dxf
// // // );
// when we are doing this we are getting the Graphics drawer is drawing exactly over the original objects
// // // Matrix ToLocal
// // // = MatrixFactory.ToCoordinateSystem
// // // (
// // // new CoordinateSystem
// // // (
// // // new Point(0,0,0)
// // // ,
// // // new Vector(1,0,0)
// // // ,
// // // /// new Vector(0,1,0)
// // // new Vector(0,0,1)
// // // )
// // // );
// // // Matrix ToLocal
// // // = MatrixFactory.ToCoordinateSystem
// // // (
// // // Script.public_static_To_Coordinate_system___public_static_identifier_id_int_for_picked_object_to_decide_front_view_and_top_view_in_dxf
// // // );
Matrix ToLocal
= MatrixFactory.ToCoordinateSystem
(
new CoordinateSystem
(
Script.public_static_To_Coordinate_system___public_static_identifier_id_int_for_picked_object_to_decide_front_view_and_top_view_in_dxf
.Origin
,
new Vector(1,0,0)
,
new Vector(0,1,0)
)
);
///////////////////////////////// tekla rotates things clockwise ///////////////////////////
Matrix RotorMatrix
=
MatrixFactory.Rotate
(
Script.ANGLE_OF_LOCAL_X_AXIS_ON_GLOBAL_XZ_FIRST_QUADRANT_GLOBAL_IN_RADIAN
,
Script.THE_Z_AXIS_AS_ROTOR_AXIS_VECTOR___AT_LOCAL_ORIGIN__AND_ALONG_GLOBAL_Z
);
///////////////////////////////// tekla rotates things clockwise ///////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
// if we do this then we see that the solids are drawn on the original object
// // // Matrix ToLocal
// // // =
// // // Script.PUBLIC_STATIC_MATRIX_PRESERVED___transformationsMatrixToGlobal;
//////////////////////////////////////////////////////////////////////////////////////////////////
/// to use this
// // // Script.THE_Z_AXIS_AS_ROTOR_AXIS_VECTOR___AT_LOCAL_ORIGIN__AND_ALONG_GLOBAL_Z
// // // Point casted_start_point
// // // = ToLocal.Transform(MyEdge.StartPoint);
// // // Point casted_final_point
// // // = ToLocal.Transform(MyEdge.EndPoint);
// // // Point casted_start_point
// // // =
// // // ToLocal.Transform
// // // (
// // // RotorMatrix.Transform
// // // (
// // // MyEdge.StartPoint
// // // )
// // // );
// // // Point casted_final_point
// // // = ToLocal.Transform
// // // (
// // // RotorMatrix.Transform
// // // (
// // // MyEdge.EndPoint
// // // )
// // // );
/////////////////////////////////////////// tested that whatever the orientation of the object is on the model
////// it will rotate and will project the objects on the global XZ plane
/////////////////////// and in the dxf files we will take x to x and the Z to Y
Point casted_start_point
=
RotorMatrix.Transform
(
ToLocal.Transform
(
MyEdge.StartPoint
)
);
Point casted_final_point
=
RotorMatrix.Transform
(
ToLocal.Transform
(
MyEdge.EndPoint
)
);
// // // Point casted_start_point
// // // = ToLocal.Transform
// // // (
// // // new Point
// // // (
// // // Math.Min(MyEdge.StartPoint.X,MyEdge.EndPoint.X)
// // // ,
// // // Math.Min(MyEdge.StartPoint.Y,MyEdge.EndPoint.Y)
// // // ,
// // // Math.Min(MyEdge.StartPoint.Z,MyEdge.EndPoint.Z)
// // // )
// // // );
// // // Point casted_final_point
// // // = ToLocal.Transform
// // // (
// // // new Point
// // // (
// // // Math.Max(MyEdge.StartPoint.X,MyEdge.EndPoint.X)
// // // ,
// // // Math.Max(MyEdge.StartPoint.Y,MyEdge.EndPoint.Y)
// // // ,
// // // Math.Max(MyEdge.StartPoint.Z,MyEdge.EndPoint.Z)
// // // )
// // // );
// // // Point shifted_start_global_origin=new Point(MyEdge.StartPoint.X - CurrentMainPartCoordinateSystem.Origin.X , MyEdge.StartPoint.Y - CurrentMainPartCoordinateSystem.Origin.Y, MyEdge.StartPoint.Z- CurrentMainPartCoordinateSystem.Origin.Z);
// // // Point shifted_final_global_origin=new Point(MyEdge.EndPoint.X- CurrentMainPartCoordinateSystem.Origin.X , MyEdge.EndPoint.Y- CurrentMainPartCoordinateSystem.Origin.Y , MyEdge.EndPoint.Z- CurrentMainPartCoordinateSystem.Origin.Z);
// // // Point shifted_start_global_origin=new Point(casted_start_point.X - CurrentMainPartCoordinateSystem.Origin.X , casted_start_point.Y - CurrentMainPartCoordinateSystem.Origin.Y, casted_start_point.Z- CurrentMainPartCoordinateSystem.Origin.Z);
// // // Point shifted_final_global_origin=new Point(casted_final_point.X- CurrentMainPartCoordinateSystem.Origin.X , casted_final_point.Y- CurrentMainPartCoordinateSystem.Origin.Y , casted_final_point.Z- CurrentMainPartCoordinateSystem.Origin.Z);
Point shifted_start_global_origin=casted_start_point;//new Point(casted_start_point.X - CurrentMainPartCoordinateSystem.Origin.X , casted_start_point.Y - CurrentMainPartCoordinateSystem.Origin.Y, casted_start_point.Z- CurrentMainPartCoordinateSystem.Origin.Z);
Point shifted_final_global_origin=casted_final_point;//new Point(casted_final_point.X- CurrentMainPartCoordinateSystem.Origin.X , casted_final_point.Y- CurrentMainPartCoordinateSystem.Origin.Y , casted_final_point.Z- CurrentMainPartCoordinateSystem.Origin.Z);
// // // Point shifted_start_global_origin=new Point(casted_start_point.X - CurrentMainPartCoordinateSystem.Origin.X , casted_start_point.Y - CurrentMainPartCoordinateSystem.Origin.Y, casted_start_point.Z- CurrentMainPartCoordinateSystem.Origin.Z);
// // // Point shifted_final_global_origin=new Point(casted_final_point.X- CurrentMainPartCoordinateSystem.Origin.X , casted_final_point.Y- CurrentMainPartCoordinateSystem.Origin.Y , casted_final_point.Z- CurrentMainPartCoordinateSystem.Origin.Z);
Point _edges_number_placer_point=new Point
(
(shifted_start_global_origin.X + shifted_final_global_origin.X)/2
,
(shifted_start_global_origin.Y + shifted_final_global_origin.Y)/2
,
(shifted_start_global_origin.Z + shifted_final_global_origin.Z)/2
);
Script.edge_counter++;
// // // Color SeeThroughBlue = new Color(0.0, 0.0, 1.0, 0.3);
// // // gd___for_rails_dxf.DrawText(_edges_number_placer_point,Script.edge_counter.ToString(),SeeThroughBlue);
// // // if(ShowCoordinateSystem.PUBLIC_STATIC_LIST__OF___PARTS___WELDED___WITH___NEAR_SIDE_OBJECTS.Contains(MyPart))
// // // {
//PUBLIC_STATIC_LIST_OF_PARTS_WELDED_IDENTIFIERS_GUID_STRINGS
// // if(PUBLIC_STATIC_LIST_OF_PARTS_WELDED_IDENTIFIERS_ID.Contains(MyPart.Identifier.ID))
// // {
if(PUBLIC_STATIC_LIST_OF_PARTS_WELDED_IDENTIFIERS_GUID_STRINGS.Contains(MyPart.Identifier.GUID.ToString()))
{
if(MyPart.Identifier.GUID==MyPart.GetAssembly().GetMainPart().Identifier.GUID)
{
// to draw the solids in the blue for main parts
gd___for_rails_dxf.DrawLineSegment(shifted_start_global_origin,shifted_final_global_origin,Blue);
}else
{
// to draw the solids in the red for secondary parts
gd___for_rails_dxf.DrawLineSegment(shifted_start_global_origin,shifted_final_global_origin,Red);
}// end of else of if(MyPart.Identifier.GUID==MyPart.GetAssembly().GetMainPart().Identifier.GUID)
}//if(PUBLIC_STATIC_LIST_OF_PARTS_WELDED_IDENTIFIERS_GUID_STRINGS.Contains(MyPart.Identifier.GUID))
//////}//if(PUBLIC_STATIC_LIST_OF_PARTS_WELDED_IDENTIFIERS_ID.Contains(MyPart.Identifier.ID))
// // // }// if(ShowCoordinateSystem.PUBLIC_STATIC_LIST__OF___PARTS___WELDED___WITH___NEAR_SIDE_OBJECTS.Contains(MyPart))
//////////////////////////////////////////////////////////////////////////////////////////////////////////
////// gd___for_rails_dxf.DrawLineSegment(coordSys.Origin, yAxisEndPt, Green);
// gd___for_rails_dxf.DrawLineSegment(coordSys.Origin, zAxisEndPt, Blue);
//////gd___for_rails_dxf.DrawLineSegment(coordSys.Origin, xAxisEndPt, Red)
if(PUBLIC_STATIC_BOOL_DO_YOU_NEED_THE_FILES_LOG_FOR_THE_EDGES)
{
System.IO.File.AppendAllText
(CURRENT_MODEL_REPORT_PATH_FOR_SOLID_FILES,
"\r\nPART_GUID=" + MyPart.Identifier.GUID.ToString()
+ " PROFILES= " + MyPart.Profile.ProfileString.ToString()
+ " Assembly_GUID_is_main_part_guid= " + MyPart.GetAssembly().GetMainPart().Identifier.GUID.ToString()
+ " "
+ " PART_POS_NUMBER = " + MyPart.GetPartMark().ToString()
+ " MAIN_PART_POS_NUMBER = " + ((Part)MyPart.GetAssembly().GetMainPart() as Part).GetPartMark().ToString()
+ " PART_NAME= " + MyPart.Name + " edge_counter = " + edge_counter.ToString()
+ " Edge_Start_point = " + MyEdge.StartPoint.ToString().Replace(",", "_")
+ " Edge_End_point = " + MyEdge.EndPoint.ToString().Replace(",", "_")
+" shifted_start_global_origin= " + shifted_start_global_origin.ToString().Replace(",", "_")
+" shifted_final_global_origin= " + shifted_final_global_origin.ToString().Replace(",", "_")
+ " Edge_Type = " + MyEdge.Type.ToString()
+ " MyEdgeType_EdgeTypeEnum_int_or_string = " + MyEdgeType_EdgeTypeEnum_int_or_string
+ " MAIN_PART_CS_origin = " + ___current_main_part_origin.ToString()
+ " MAIN_PART_CS_X_AXIS = " + ___current_main_part_AxisX.ToString()
+ " MAIN_PART_CS_Y_AXIS = " + ___current_main_part_AxisY.ToString()
+ " MAIN_PART_CS_Z_AXIS = " + ___current_main_part_AxisZ.ToString()
+ " CURR_PART_CS_origin = " + ___current_part_origin.ToString()
+ " CURR_PART_CS_X_AXIS = " + ___current_part_AxisX.ToString()
+ " CURR_PART_CS_Y_AXIS = " + ___current_part_AxisY.ToString()
+ " CURR_PART_CS_Z_AXIS = " + ___current_part_AxisZ.ToString()
+ " TO_LOG_PROJECTED_START_POINT_on_Fviews = "+ TO_LOG_PROJECTED_START_POINT_ON_FRONT_VIEW___AFTER_TRANSFORMATIONS.ToString().Replace(",", "_")
+ " TO_LOG_PROJECTED_FINAL_POINT_on_Fviews = " + TO_LOG_PROJECTED_FINAL_POINT_ON_FRONT_VIEW___AFTER_TRANSFORMATIONS.ToString().Replace(",", "_")
+ " TO_LOG_PROJECTED_START_POINT_on_Tviews = " + TO_LOG_PROJECTED_START_POINT_ON_TOP_VIEW___AFTER_TRANSFORMATIONS.ToString().Replace(",", "_")
+ " TO_LOG_PROJECTED_FINAL_POINT_on_Tviews = " + TO_LOG_PROJECTED_FINAL_POINT_ON_TOP_VIEW___AFTER_TRANSFORMATIONS.ToString().Replace(",", "_")
+ " date = " + System.DateTime.Now.ToString()
);
}//if(PUBLIC_STATIC_BOOL_DO_YOU_NEED_THE_FILES_LOG_FOR_THE_EDGES)
}//if(MyEdge!=null)
}// while (MyEdgeEnums.MoveNext())
//public static bool PUBLIC_STATIC_BOOL_DO_YOU_NEED_THE_FILES_LOG_FOR_THE_EDGES=false;
//public static bool PUBLIC_STATIC_BOOL_DO_YOU_NEED_THE_FILES_LOG_FOR_THE_faces_and_loops=false;
if(PUBLIC_STATIC_BOOL_DO_YOU_NEED_THE_FILES_LOG_FOR_THE_faces_and_loops)
{
}
else
{
goto goto_here_when_we_dont_log_for_faces_or_loops;
}//endof else of if(PUBLIC_STATIC_BOOL_DO_YOU_NEED_THE_FILES_LOG_FOR_THE_faces_and_loops)
while (MyFaceEnum.MoveNext())
{
Face MyFace = MyFaceEnum.Current as Face;
if (MyFace != null)
{
face_counter++;
MyFaceNormalList.Add(MyFace.Normal);
LoopEnumerator MyLoopEnum = MyFace.GetLoopEnumerator();
Vector Temp_normal_vector_for_current_loop = MyFace.Normal;
while (MyLoopEnum.MoveNext())
{
Loop MyLoop = MyLoopEnum.Current as Loop;
if (MyLoop != null)
{
loop_counter++;
VertexEnumerator MyVertexEnum = MyLoop.GetVertexEnumerator() as VertexEnumerator;
while (MyVertexEnum.MoveNext())
{
Point MyVertex = MyVertexEnum.Current as Point;
if (MyVertex != null)
{
vertex_counter++;
MyList.Add(MyVertex);
get_integer_property_for_TOTAL_NODES_IN_SOLIDS++;
//////int face_counter = 0;
//////int loop_counter = 0;
//////int vertex_counter = 0;
//////System.IO.File.AppendAllText
////// (CURRENT_MODEL_REPORT_PATH_FOR_SOLID_FILES, "\r\n"+ " PART_GUID=" + MyPart.Identifier.GUID.ToString() +" PROFILES= "+ MyPart.Profile.ProfileString.ToString() + " Assembly_GUID_is_main_part_guid= " + MyPart.GetAssembly().GetMainPart().Identifier.GUID.ToString()+ " " + " PART_POS_NUMBER = " + MyPart.GetPartMark().ToString() + " MAIN_PART_POS_NUMBER = " + ((Part)MyPart.GetAssembly().GetMainPart() as Part).GetPartMark().ToString() + " PART_NAME= " + MyPart.Name + " face_counter = " + face_counter.ToString() + " loop_counter = " + loop_counter.ToString() + " vertex_counter = " + vertex_counter.ToString() + " " + MyVertex.ToString().Replace(",","_") +" current_loops_normal_vector= " + Temp_normal_vector_for_current_loop.ToString().Replace(",", "_") + " main_part_coordinates_systems_CS_origin = " + MyPart.GetAssembly().GetMainPart().GetCoordinateSystem().Origin.ToString() + " MAIN_PART_CS_X_AXIS = " + MyPart.GetAssembly().GetMainPart().GetCoordinateSystem().AxisX.ToString() + " MAIN_PART_CS_Y_AXIS = " + MyPart.GetAssembly().GetMainPart().GetCoordinateSystem().AxisY.ToString() + " date = " + System.DateTime.Now.ToString());
TO_LOG_PROJECTED_FACE_LOOP_POINT_ON_FRONT_VIEW___AFTER_TRANSFORMATIONS
=
// CustomPropertyRAILSDXF.
PUBLIC_STATIC_CLASS_FOR_SAAN_CALCULATIONS_OF_GEOMETRYS
.GetProjectedPoint
(
MyVertex
,
___assembly_front_view_origin
,
___assembly_front_view_AxisX
,
___assembly_front_view_AxisY
,
___assembly_front_view_AxisZ
);
TO_LOG_PROJECTED_FACE_LOOP_POINT_ON_TOP_VIEW___AFTER_TRANSFORMATIONS
=
//CustomPropertyRAILSDXF.
PUBLIC_STATIC_CLASS_FOR_SAAN_CALCULATIONS_OF_GEOMETRYS
.GetProjectedPoint
(
MyVertex
,
___assembly_top_view_origin
,
___assembly_top_view_AxisX
,
___assembly_top_view_AxisY
,
___assembly_top_view_AxisZ
);
System.IO.File.AppendAllText
(CURRENT_MODEL_REPORT_PATH_FOR_SOLID_FILES
,
"\r\n"
+ " PART_GUID=" + MyPart.Identifier.GUID.ToString()
+ " PROFILES= " + MyPart.Profile.ProfileString.ToString()
+ " Assembly_GUID_is_main_part_guid= " + MyPart.GetAssembly().GetMainPart().Identifier.GUID.ToString()
+ " " + " PART_POS_NUMBER = " + MyPart.GetPartMark().ToString()
+ " MAIN_PART_POS_NUMBER = " + ((Part)MyPart.GetAssembly().GetMainPart() as Part).GetPartMark().ToString()
+ " PART_NAME= " + MyPart.Name
+ " face_counter = " + face_counter.ToString()
+ " loop_counter = " + loop_counter.ToString()
+ " vertex_counter = " + vertex_counter.ToString()
+ " vertex_point = " + MyVertex.ToString().Replace(",", "_")
+ " projected_on_front_view_for_this_vertex_point = " + TO_LOG_PROJECTED_FACE_LOOP_POINT_ON_FRONT_VIEW___AFTER_TRANSFORMATIONS.ToString().Replace(",", "_")
+ " projected_on_top_view_for_this_vertex_point = " + TO_LOG_PROJECTED_FACE_LOOP_POINT_ON_TOP_VIEW___AFTER_TRANSFORMATIONS.ToString().Replace(",", "_")
+ " current_loops_normal_vector= " + Temp_normal_vector_for_current_loop.ToString().Replace(",", "_")
//////+ " main_part_coordinates_systems_CS_origin = " + MyPart.GetAssembly().GetMainPart().GetCoordinateSystem().Origin.ToString()
//////+ " MAIN_PART_CS_X_AXIS = " + MyPart.GetAssembly().GetMainPart().GetCoordinateSystem().AxisX.ToString()
//////+ " MAIN_PART_CS_Y_AXIS = " + MyPart.GetAssembly().GetMainPart().GetCoordinateSystem().AxisY.ToString()
+ " MAIN_PART_CS_origin = " + ___current_main_part_origin.ToString()
+ " MAIN_PART_CS_X_AXIS = " + ___current_main_part_AxisX.ToString()
+ " MAIN_PART_CS_Y_AXIS = " + ___current_main_part_AxisY.ToString()
+ " MAIN_PART_CS_Z_AXIS = " + ___current_main_part_AxisZ.ToString()
+ " CURR_PART_CS_origin = " + ___current_part_origin.ToString()
+ " CURR_PART_CS_X_AXIS = " + ___current_part_AxisX.ToString()
+ " CURR_PART_CS_Y_AXIS = " + ___current_part_AxisY.ToString()
+ " CURR_PART_CS_Z_AXIS = " + ___current_part_AxisZ.ToString()
+ " date = " + System.DateTime.Now.ToString());
}// if (MyVertex != null)
}// while (MyVertexEnum.MoveNext())
}// if (MyLoop != null)
}// while (MyLoopEnum.MoveNext())
}//if (MyFace != null)
}//while(MyFaceEnum.MoveNext())
goto_here_when_we_dont_log_for_faces_or_loops:;
get_string_property_For_THE_MODEL_OBJECT_TYPES
= "face_counter= " + face_counter.ToString() + "_loop_counter= " + loop_counter.ToString() + "_edge_counter= "+ edge_counter.ToString() + "_vertex_counter = " + vertex_counter.ToString();// + get_integer_property_for_TOTAL_NODES_IN_SOLIDS.ToString();
////// = modelObject.GetType().ToString().Replace("Tekla.Structures.Model.", "").Trim().TrimEnd().TrimStart().ToUpper();
}
catch (Exception _EXCEPTIONS_TO_READ_SOLIDS)
{
System.IO.File.AppendAllText
(
CURRENT_MODEL_REPORT_PATH_FOR_SOLID_FILES
,
(
"_EXCEPTIONS_TO_READ_SOLIDS part to solid or other error " +
_EXCEPTIONS_TO_READ_SOLIDS.Message +
_EXCEPTIONS_TO_READ_SOLIDS.StackTrace.ToString()
+"for_model_object =" +
"modelObject TYPES FOUND = " + modelObject.GetType().ToString()
+
" modelObject_guid = " + modelObject.Identifier.GUID.ToString()
+
" ___get_model_objects_report_property_POS_number = " + ___get_model_objects_report_property_POS_number
+ " ModificationTime = " + modelObject.ModificationTime.ToString()
+ " IsUpToDate=" + modelObject.IsUpToDate.ToString()
).ToString().Replace("\r\n", "_").Replace("\r", "_").Replace("\n", "_")
);
} //catch(Exception _EXCEPTIONS_TO_READ_SOLIDS)
if (get_string_property_For_THE_MODEL_OBJECT_TYPES=="")
{
// get_string_property_For_THE_MODEL_OBJECT_TYPES
// = modelObject..ToString().Replace("Tekla.Structures.Model.", "").Trim().TrimEnd().TrimStart().ToUpper();
}// if(get_string_property_For_THE_MODEL_OBJECT_TYPES=="")
//////////// if (position_depth_string == "MIDDLE")
//////////// {
//////////// position_depth_int = 0;//_current_line_splitted[6];
//////////// _current_beam.Position.Depth = Position.DepthEnum.MIDDLE;
//////////// }//if (position_depth_string=="MIDDLE")
//////////// if (position_depth_string == "FRONT")
//////////// {
//////////// position_depth_int = 1;//_current_line_splitted[6];
//////////// _current_beam.Position.Depth = Position.DepthEnum.FRONT;
//////////// }//if (position_depth_string=="FRONT")
//////////// if (position_depth_string == "BEHIND")
//////////// {
//////////// position_depth_int = 2;//_current_line_splitted[6];
//////////// _current_beam.Position.Depth = Position.DepthEnum.BEHIND;
//////////// }//if (position_depth_string=="BEHIND")
//////////// _current_beam.Position.DepthOffset = position_depthOffset_double;
///
///
///
///
///
// // // if (get_integer_property_for_Depth==0)
// // // {
// // // get_string_property_For_Depth = "MIDDLE";
// // // }// if(get_integer_property_for_Depth==0)
// // // if (get_integer_property_for_Depth == 1)
// // // {
// // // get_string_property_For_Depth = "FRONT";
// // // }//if (get_integer_property_for_Depth == 1)
// // // if (get_integer_property_for_Depth == 2)
// // // {
// // // get_string_property_For_Depth = "BEHIND";
// // // }// if(get_integer_property_for_Depth==2)
/// return GetDoubleProperty(objectId).ToString();
//////ArrayList arrayList = new ArrayList();
//////string text = "";
//////ModelObject modelObject = this.model.SelectModelObject(new Identifier(objectId));
//////Part part = (Part)modelObject;
//////bool flag = part != null;
//////string result="";
////////////if (flag)
////////////{
//////////// this._MODEL_ENUM = part.GetBolts();
//////////// while (this._MODEL_ENUM.MoveNext())
//////////// {
//////////// this._BOLT_GRP = (this._MODEL_ENUM.Current as BoltGroup);
//////////// double boltSize = this._BOLT_GRP.BoltSize;
//////////// int count = this._BOLT_GRP.BoltPositions.Count;
//////////// string boltStandard = this._BOLT_GRP.BoltStandard;
//////////// string text2 = this._object_to_convert_into_inch_frac._get_mm_and_convert_to_1_16_feet_inch_format(boltSize);
//////////// text = text2.ToString().Split(new string[]
//////////// {
//////////// "-"
//////////// }, StringSplitOptions.None)[1].Replace("\"", "") + "Ø ";
//////////// bool flag2 = text.Contains(" 0");
//////////// if (flag2)
//////////// {
//////////// text = "w/ " + text.Replace(" 0", "") + boltStandard;
//////////// }
//////////// else
//////////// {
//////////// text = "w/ " + text + boltStandard;
//////////// }
//////////// }
//////////// result = text.ToString();
////////////}
////////////else
////////////{
//////////// result = "NA";
////////////}
// return result;
}
catch (Exception excp_for_solids_api)
{
get_string_property_For_THE_MODEL_OBJECT_TYPES
=
modelObject.GetType().ToString() + " excp= "
+ excp_for_solids_api.Message.ToString().Replace(",", "_");
}//catch (Exception excp_for_solids_api)
/// return get_string_property_For_Depth;
// return get_integer_property_for_TOTAL_NODES_IN_SOLIDS.ToString();
return get_string_property_For_THE_MODEL_OBJECT_TYPES;
}// public static string GetStringProperty(int objectId)
} // public class Script
public static class PUBLIC_STATIC_CLASS_FOR_SAAN_CALCULATIONS_OF_GEOMETRYS
{
public static string to_log_path______CURRENT_MODEL_REPORT_PATH_FOR_SOLID_FILES = "";
public static Point GetProjectedPoint(Point given_point3D, Point given_CS_origin, Vector given_CS_Axis_x, Vector given_CS_Axis_y, Vector given_CS_Axis_z)
{
Point projectedPoint = new Point(-0.003, -0.006, 0.001);
try
{
try
{
Matrix transformationMatrix = CreateTransformationMatrix(given_CS_origin, given_CS_Axis_x, given_CS_Axis_y, given_CS_Axis_z);
}
catch(Exception excp_to_generate_the_matrix)
{
}//catch(Exception excp_to_generate_the_matrix)
// Create the transformation matrix from the custom coordinate system
// Project the 3D point onto the XY plane of the custom coordinate system
projectedPoint = ProjectPointOntoPlane(given_point3D, given_CS_origin, given_CS_Axis_x, given_CS_Axis_y, given_CS_Axis_z);
}
catch (Exception _excp_to_projectdatapoint)
{
projectedPoint = new Point(-338.33, -061.33, -338.33);
Tekla.Structures.Model.Model DETASYSDOTCOM_mo = new Tekla.Structures.Model.Model();
Tekla.Structures.Model.ModelInfo current_models_Info = DETASYSDOTCOM_mo.GetInfo();
//Tekla.Structures.Geometry3d.aabb
string CURRENT_MODEL_PATH = "";//current_models_Info.ModelPath
CURRENT_MODEL_PATH = current_models_Info.ModelPath.Replace("\\", "\\\\");
//////string CURRENT_MODEL_PATH_SOL_ENGINEERING_REPORTS = CURRENT_MODEL_PATH + "\\\\SOL_ENGINEERING_REPORTS\\\\";
//////string CURRENT_MODELS_NORTH_DIRECTION_THETA = current_models_Info.NorthDirection;//this comes from the model info
//////_theta = CURRENT_MODELS_NORTH_DIRECTION_THETA;//_my_model_info.NorthDirection;
string CURRENT_MODEL_REPORT_PATH = CURRENT_MODEL_PATH + "\\Reports";
string CURRENT_MODEL_REPORT_PATH_FOR_SOLID_FILES
=
CURRENT_MODEL_REPORT_PATH + "\\solids_report_from_SOL_TEKLA_TO_STAAD.SOLID";
System.IO.File.AppendAllText
(
CURRENT_MODEL_REPORT_PATH_FOR_SOLID_FILES
,
"_excp_to_projectdatapoint for given_point3D = " + given_point3D.ToString()
);
}//catch(Exception _excp_to_projectdatapoint)
return projectedPoint;
}//public static Point GetProjectedPoint(Point given_point3D,Point given_CS_origin,Vector given_CS_Axis_x , Vector given_CS_Axis_y , Vector given_CS_Axis_z)
public static Matrix CreateTransformationMatrix(Point origin, Vector axisX, Vector axisY, Vector axisZ)
{
Matrix matrix = new Matrix();
/// i think there is some array index out of bounds
///
//////matrix.Set(axisX.X, axisY.X, axisZ.X, origin.X,
////// axisX.Y, axisY.Y, axisZ.Y, origin.Y,
////// axisX.Z, axisY.Z, axisZ.Z, origin.Z,
////// 0, 0, 0, 1);
// matrix = new double[4, 4];
/// i think i have to use the matrixfactory for this
//////matrix[0, 0] = axisX.X;
//////matrix[0, 1] = axisY.X;
//////matrix[0, 2] = axisZ.X;
//////matrix[0, 3] = origin.X;
//////matrix[1, 0] = axisX.Y;
//////matrix[1, 1] = axisY.Y;
//////matrix[1, 2] = axisZ.Y;
//////matrix[1, 3] = origin.Y;
//////matrix[2, 0] = axisX.Z;
//////matrix[2, 1] = axisY.Z;
//////matrix[2, 2] = axisZ.Z;
//////matrix[2, 3] = origin.Z;
//////matrix[3, 0] = 0;
//////matrix[3, 1] = 0;
//////matrix[3, 2] = 0;
//////matrix[3, 3] = 1;
return matrix;
}//public static Matrix CreateTransformationMatrix(Point origin, Vector axisX, Vector axisY, Vector axisZ)
public static Point ProjectPointOntoPlane(Point given_point, Point cs_origin, Vector cs_axisX, Vector cs_axisY, Vector cs_axisZ)
{
// Translate the point to the custom coordinate system origin
Vector translatedPoint = new Vector(0, 0, 0);
try
{
translatedPoint =
new Vector(given_point.X - cs_origin.X, given_point.Y - cs_origin.Y, given_point.Z - cs_origin.Z);
}
catch(Exception _excp_generating_error_for_translatedPoint)
{
Tekla.Structures.Model.Model DETASYSDOTCOM_mo = new Tekla.Structures.Model.Model();
Tekla.Structures.Model.ModelInfo current_models_Info = DETASYSDOTCOM_mo.GetInfo();
//Tekla.Structures.Geometry3d.aabb
string CURRENT_MODEL_PATH = "";//current_models_Info.ModelPath
CURRENT_MODEL_PATH = current_models_Info.ModelPath.Replace("\\", "\\\\");
//////string CURRENT_MODEL_PATH_SOL_ENGINEERING_REPORTS = CURRENT_MODEL_PATH + "\\\\SOL_ENGINEERING_REPORTS\\\\";
//////string CURRENT_MODELS_NORTH_DIRECTION_THETA = current_models_Info.NorthDirection;//this comes from the model info
//////_theta = CURRENT_MODELS_NORTH_DIRECTION_THETA;//_my_model_info.NorthDirection;
string CURRENT_MODEL_REPORT_PATH = CURRENT_MODEL_PATH + "\\Reports";
string CURRENT_MODEL_REPORT_PATH_FOR_SOLID_FILES
=
CURRENT_MODEL_REPORT_PATH + "\\solids_report_from_SOL_TEKLA_TO_STAAD.SOLID";
System.IO.File.AppendAllText
(
CURRENT_MODEL_REPORT_PATH_FOR_SOLID_FILES
,
"_excp_generating_error_for_translatedPoint for given_point = " + given_point.ToString()
+ " translatedPoint = " + translatedPoint.ToString()
);
}//catch(Exception _excp_generating_error_for_translatedPoint)
// Project the translated point onto the XY plane of the custom coordinate system
double projectedX = 0;
//////projectedX
////// =
//////translatedPoint.Dot(cs_axisX);
projectedX
=
translatedPoint.X * cs_axisX.X
+
translatedPoint.Y * cs_axisX.Y
+
translatedPoint.Z * cs_axisX.Z
;
double projectedY = 0;
//////projectedY
////// =
//////translatedPoint.Dot(cs_axisY);
projectedY
=
translatedPoint.X * cs_axisY.X
+
translatedPoint.Y * cs_axisY.Y
+
translatedPoint.Z * cs_axisY.Z
;
double projectedZ = 0.0; // Since it's a projection onto the XY plane
return new Point(projectedX, projectedY, projectedZ);
}// public static Point ProjectPointOntoPlane(Point given_point, Point cs_origin, Vector cs_axisX, Vector cs_axisY, Vector cs_axisZ)
public static Matrix InvertMatrix(Matrix matrix)
{
// Assuming the matrix is 4x4, we will use a simple method to compute the inverse
Matrix inverse = new Matrix();
// Extract elements for easier access
double[,] m = new double[4, 4];
for (int row = 0; row < 4; row++)
{
for (int col = 0; col < 4; col++)
{
m[row, col] = matrix[row, col];
}//for (int col = 0; col < 4; col++)
}// for (int row = 0; row < 4; row++)
// Compute the inverse using Gauss-Jordan elimination
double determinant =
m[0, 0] * (m[1, 1] * m[2, 2] - m[1, 2] * m[2, 1])
- m[0, 1] * (m[1, 0] * m[2, 2] - m[1, 2] * m[2, 0])
+ m[0, 2] * (m[1, 0] * m[2, 1] - m[1, 1] * m[2, 0]);
if (Math.Abs(determinant) < 1e-10)
{
throw new InvalidOperationException("Matrix is singular, cannot invert.");
}// if (Math.Abs(determinant) < 1e-10)
double invDet = 1.0 / determinant;
inverse[0, 0] = invDet * (m[1, 1] * m[2, 2] - m[1, 2] * m[2, 1]);
inverse[0, 1] = invDet * (m[0, 2] * m[2, 1] - m[0, 1] * m[2, 2]);
inverse[0, 2] = invDet * (m[0, 1] * m[1, 2] - m[0, 2] * m[1, 1]);
inverse[0, 3] = -(
m[0, 3] * (m[1, 1] * m[2, 2] - m[1, 2] * m[2, 1])
- m[0, 1] * (m[1, 3] * m[2, 2] - m[1, 2] * m[2, 3])
+ m[0, 2] * (m[1, 3] * m[2, 1] - m[1, 1] * m[2, 3])
);
inverse[1, 0] = invDet * (m[1, 2] * m[2, 0] - m[1, 0] * m[2, 2]);
inverse[1, 1] = invDet * (m[0, 0] * m[2, 2] - m[0, 2] * m[2, 0]);
inverse[1, 2] = invDet * (m[0, 2] * m[1, 0] - m[0, 0] * m[1, 2]);
inverse[1, 3] = (
m[0, 3] * (m[1, 2] * m[2, 0] - m[1, 0] * m[2, 2])
- m[0, 0] * (m[1, 3] * m[2, 2] - m[1, 2] * m[2, 3])
+ m[0, 2] * (m[1, 3] * m[2, 0] - m[1, 0] * m[2, 3])
);
inverse[2, 0] = invDet * (m[1, 0] * m[2, 1] - m[1, 1] * m[2, 0]);
inverse[2, 1] = invDet * (m[0, 1] * m[2, 0] - m[0, 0] * m[2, 1]);
inverse[2, 2] = invDet * (m[0, 0] * m[1, 1] - m[0, 1] * m[1, 0]);
inverse[2, 3] = -(
m[0, 3] * (m[1, 0] * m[2, 1] - m[1, 1] * m[2, 0])
- m[0, 0] * (m[1, 3] * m[2, 1] - m[1, 1] * m[2, 3])
+ m[0, 1] * (m[1, 3] * m[2, 0] - m[1, 0] * m[2, 3])
);
inverse[3, 0] = 0;
inverse[3, 1] = 0;
inverse[3, 2] = 0;
inverse[3, 3] = 1;
return inverse;
}// public static Matrix InvertMatrix(Matrix matrix)
public static void PrintMatrix(Matrix matrix)
{
for (int row = 0; row < 4; row++)
{
for (int col = 0; col < 4; col++)
{
//Console.Write($"{matrix[row, col]:F2}\t");
System.IO.File.AppendAllText("D:\\_report_matrix.txt","\r\n"+matrix[row, col].ToString() + "\t");
}//for (int col = 0; col < 4; col++)
Console.WriteLine();
}//for (int row = 0; row < 4; row++)
}// public static void PrintMatrix(Matrix matrix)
}//public static class PUBLIC_STATIC_CLASS_FOR_SAAN_CALCULATIONS_OF_GEOMETRYS
public class Vector3
{
public double X { get; set; }
public double Y { get; set; }
public double Z { get; set; }
public Vector3()
{
X = 0;
Y = 0;
Z = 0;
}//public Vector3()
public Vector3(double x, double y, double z)
{
X = x;
Y = y;
Z = z;
}//public Vector3(double x, double y, double z)
// public static Vector3 Zero_or_null_vector => new Vector3(0, 0, 0);
public static Vector3 Zero_or_null_vector = new Vector3(0, 0, 0);
public static Vector3 operator +(Vector3 a, Vector3 b)
{
return new Vector3(a.X + b.X, a.Y + b.Y, a.Z + b.Z);
}// public static Vector3 operator +(Vector3 a, Vector3 b)
public static Vector3 operator -(Vector3 a, Vector3 b)
{
return new Vector3(a.X - b.X, a.Y - b.Y, a.Z - b.Z);
}//public static Vector3 operator -(Vector3 a, Vector3 b)
public static Vector3 operator /(Vector3 v, float scalar)
{
return new Vector3(v.X / scalar, v.Y / scalar, v.Z / scalar);
}//public static Vector3 operator /(Vector3 v, float scalar)
public static Vector3 operator *(Vector3 v, float scalar)
{
return new Vector3(v.X * scalar, v.Y * scalar, v.Z * scalar);
}//public static Vector3 operator *(Vector3 v, float scalar)
public static double Dot(Vector3 a, Vector3 b)
{
return a.X * b.X + a.Y * b.Y + a.Z * b.Z;
}//public static double Dot(Vector3 a, Vector3 b)
public static Vector3 Min(Vector3 a, Vector3 b)
{
return new Vector3(Math.Min(a.X, b.X), Math.Min(a.Y, b.Y), Math.Min(a.Z, b.Z));
}//public static Vector3 Min(Vector3 a, Vector3 b)
public static Vector3 Max(Vector3 a, Vector3 b)
{
return new Vector3(Math.Max(a.X, b.X), Math.Max(a.Y, b.Y), Math.Max(a.Z, b.Z));
}//public static Vector3 Max(Vector3 a, Vector3 b)
public override string ToString()
{
// return $"({X}, {Y}, {Z})";
return X + " i + " + Y + " j + " + Z;
}// public override string ToString()
// // // public static double GetAngleOnPlane(Vector3 localVector, Vector3 axis1, Vector3 axis2)
// // // {
// // // // Project the local vector onto the plane defined by axis1 and axis2
// // // Vector3 projection = Vector3.Dot(localVector, axis1) * axis1 + Vector3.Dot(localVector, axis2) * axis2;
// // // // Calculate the angle between the projection and axis1
// // // double angle = Math.Acos(Vector3.Dot(Vector3.Normalize(projection), axis1));
// // // // Ensure the angle is in the first quadrant
// // // if (Vector3.Dot(projection, axis2) < 0)
// // // {
// // // angle = 2 * Math.PI - angle;
// // // }//if (Vector3.Dot(projection, axis2) < 0)
// // // return angle;
// // // }// public static double GetAngleOnPlane(Vector3 localVector, Vector3 axis1, Vector3 axis2)
}//public class Vector3
}//namespace Tekla.Technology.Akit.UserScript
Comments
Post a Comment