Skip to content
Snippets Groups Projects
Commit 75bc2854 authored by Seyedali Pasandideh's avatar Seyedali Pasandideh
Browse files

Tu4 final

parent 835860ad
No related branches found
No related tags found
No related merge requests found
Showing
with 1294 additions and 2 deletions
No preview for this file type
...@@ -22,10 +22,29 @@ Partial Class Form1 ...@@ -22,10 +22,29 @@ Partial Class Form1
'Do not modify it using the code editor. 'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _ <System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent() Private Sub InitializeComponent()
components = New System.ComponentModel.Container() Me.Button1 = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(367, 301)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(75, 77)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Button1"
Me.Button1.UseVisualStyleBackColor = True
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 16.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(800, 450) Me.ClientSize = New System.Drawing.Size(800, 450)
Me.Controls.Add(Me.Button1)
Me.Name = "Form1"
Me.Text = "Form1" Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub End Sub
Friend WithEvents Button1 As Button
End Class End Class
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
Public Class Form1 Imports INFITF
Imports DNBIgpTagPath
Imports ProductStructureTypeLib
Imports DNBSimAct
Public Class Form1
Public Shared CATIA As INFITF.Application = GetObject(vbNullString, "Catia.Application")
Public Shared Objects2select = CATIA.ActiveDocument.Selection
Public Shared documents1 = CATIA.Documents
Public Shared Objects2select1 = CATIA.ActiveDocument.Selection
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim partDocument1 = documents1.Item("Part2.CATPart")
Dim part1 As MECMOD.Part = partDocument1.Part
Dim Parameters1 = part1.Parameters
Dim hybridBody12 = part1.HybridBodies.Add()
hybridBody12.Name = "poly"
Dim stepdir1 = 0.5
Parameters1.Item("P1").Value = -10
Parameters1.Item("R2").Value = 10
part1.Update()
Dim k = 0
Dim inters = 0
'first collision
Dim Dir_v1 = 1.0
Dim Start_v1 = -10
Dim End_v1 = 50.0
Dim Step_v1 = 3.0
Dim P1_val = Functions.check_rep(k, part1, Parameters1, "P1", Dir_v1, Start_v1, End_v1, Step_v1)
Dim first_poly = 0
Dim last_poly = 0
For j = 1 To 100
inters = inters + 1
Dim hybridBody11 = part1.HybridBodies.Add()
hybridBody11.Name = "inters_geo" & inters
'finding intersections all around the circle
For i = 1 To 359 Step 20
Parameters1.Item("A1").Value = i
Parameters1.Item("R2").Value = 10.1
Dir_v1 = 1
Start_v1 = 0.5
End_v1 = 10
Step_v1 = 3
k = 0
Dim V1 = Functions.check_rep(k, part1, Parameters1, "R2", Dir_v1, Start_v1, End_v1, Step_v1)
' If V1 > End_v1 - 0.5 Then
' Objects2select.add(hybridBody11)
' Objects2select.Delete()
' Objects2select.Clear()
' End If
'creating point on the found interactions
Parameters1.Item("A1").Value = i
Dim point2D1 As Object = part1.HybridBodies.Item(1).HybridShapes.Item("PM")
Dim point3D1 As Object = point2D1
Dim Coords(2)
point3D1.GetCoordinates(Coords)
Dim hybridShapePointCoord1 = part1.HybridShapeFactory.AddNewPointCoord(Coords(0), Coords(1), Coords(2))
hybridBody11.AppendHybridShape(hybridShapePointCoord1)
part1.Update()
If i >= 341 Then
Dim poly1 = Functions.create_poly(part1, hybridBody12, hybridBody11, j)
If first_poly = 0 Then
first_poly = j
End If
last_poly = j
End If
Next
stepdir1 = 0.3
P1_val = P1_val + stepdir1
Parameters1.Item("P1").Value = P1_val
Parameters1.Item("R2").Value = 10
part1.Update()
Dim clash = Functions.clash()
If clash = 0 Then
Exit For
End If
Next
Dim hybridBodies1 = part1.HybridBodies
Dim hybridBodey1 = hybridBodies1.Item(1)
Dim hyridBody2 = hybridBodies1.Add()
hyridBody2.Name = "Surfaces"
Dim hybridShapes1 = hybridBodey1.HybridShapes
Dim surf1
For polyn = first_poly To last_poly - 1
surf1 = Functions.surface(part1, hybridShapes1, polyn, polyn + 1, hyridBody2)
Next
End Sub
Public Class Functions
Public Shared Function check_rep(k, part1, Parameters1, paramname, Dir_, start_val, end_val, step_size)
k = check_col(k, step_size, part1, Parameters1, paramname, Dir_, start_val, end_val)
k = k - Dir_ * step_size
step_size = step_size / 10
k = check_col(k, step_size, part1, Parameters1, paramname, Dir_, 0, end_val)
k = k - Dir_ * step_size
step_size = step_size / 10
k = check_col(k, step_size, part1, Parameters1, paramname, Dir_, 0, end_val)
Return k
End Function
Public Shared Function create_poly(part1, hybridBody12, hybridBody11, i)
Dim hybridShapeFactory1 = part1.HybridShapeFactory
Dim hybridShapePolyline1 = hybridShapeFactory1.AddNewPolyline()
Dim hybridShapes1 = hybridBody11.Hybridshapes
Dim point_nr = 1
Dim reference1
Dim hybridShapePointCoord1
For i = 1 To hybridShapes1.Count
hybridShapePointCoord1 = hybridShapes1.Item(i)
reference1 = part1.CreateReferenceFromObject(hybridShapePointCoord1)
hybridShapePolyline1.InsertElement(reference1, point_nr)
point_nr = point_nr + 1
Next
hybridShapePointCoord1 = hybridShapes1.Item(1)
reference1 = part1.CreateReferenceFromObject(hybridShapePointCoord1)
hybridShapePolyline1.InsertElement(reference1, point_nr)
hybridShapePolyline1.Closure = False
hybridBody12.AppendHybridShape(hybridShapePolyline1)
hybridShapePolyline1.Name = "Poly" & i
'part1.InWorkObject = hybridShapePolyline1
part1.Update()
End Function
Public Shared Function check_col(k, steg1, part1, Parameters1, paramname, Dir_, start_val, end_v)
k = start_val + k
'Parameters1.Item(paramname).Value = k
part1.Update()
Dim loop2 = (end_v - k) / steg1
Dim kl
For i = 1 To loop2
k = Dir_ * steg1 + k
Parameters1.Item(paramname).Value = k
part1.Update()
kl = clash()
If kl > 0 Then
Exit For
End If
Next
Return kl
End Function
Public Shared Function clash()
Dim CATIA = GetObject(, "CATIA.Application")
Dim oDocs = CATIA.Documents
Dim oProductDoc = CATIA.ActiveDocument
Dim oProduct = oProductDoc.Product
Dim oProducts = oProduct.Products
Dim oSel = oProductDoc.Selection
oSel.Clear
oSel.Add(oProduct)
Dim cClashes = oProduct.GetTechnologicalObject("Clashes")
Dim oClash = cClashes.AddFromSel
oClash.ComputationType = 0
oClash.InterferenceType = 1 'Clash + Contact
oClash.Compute
Dim cConflicts = oClash.Conflicts
Dim k = cConflicts.Count
Return k
End Function
Public Shared Function surface(part1, hybridshapes1, poly1, poly2, hybridbody2)
Dim hybridShapeFactory1 = part1.HybridShapeFactory
Dim hybridShapeBlend1 = hybridShapeFactory1.AddNewBlend()
hybridShapeBlend1.Coupling = 1
Dim hybridShapePolyline1 = hybridshapes1.Item("Poly" & poly1)
Dim reference1 = part1.CreateReferenceFromObject(hybridShapePolyline1)
hybridShapeBlend1.SetCurve(1, reference1)
hybridShapeBlend1.SetOrientation(1, 1)
Dim hybridpoint1 = part1.HybridBodies.Item("inters_geo" & poly1).HybridShapes.Item(1)
Dim reference2 = part1.CreateReferenceFromObject(hybridpoint1)
hybridShapeBlend1.SetClosingPoint(1, reference2)
Dim hybridShapePolyline2 = hybridshapes1.Item("Poly" & poly2)
Dim reference3 = part1.CreateReferenceFromObject(hybridShapePolyline2)
hybridShapeBlend1.SetCurve(2, reference3)
hybridShapeBlend1.SetOrientation(2, 1)
Dim hybridpoint2 = part1.HybridBodies.Item("inters_geo" & poly2).HybridShapes.Item(1)
Dim reference4 = part1.CreateReferenceFromObject(hybridpoint2)
hybridShapeBlend1.SetClosingPoint(2, reference4)
hybridShapeBlend1.SmoothAngleThresholdActivity = False
hybridShapeBlend1.SmoothDeviationActivity = False
hybridShapeBlend1.RuledDevelopableSurface = False
hybridbody2.AppendHybridShape(hybridShapeBlend1)
part1.InWorkObject = hybridShapeBlend1
part1.Update()
End Function
End Class
End Class End Class
This diff is collapsed.
File added
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
\ No newline at end of file
File added
<?xml version="1.0"?>
<doc>
<assembly>
<name>
T4
</name>
</assembly>
<members>
<member name="T:T4.My.Resources.Resources">
<summary>
A strongly-typed resource class, for looking up localized strings, etc.
</summary>
</member>
<member name="P:T4.My.Resources.Resources.ResourceManager">
<summary>
Returns the cached ResourceManager instance used by this class.
</summary>
</member>
<member name="P:T4.My.Resources.Resources.Culture">
<summary>
Overrides the current thread's CurrentUICulture property for all
resource lookups using this strongly typed resource class.
</summary>
</member>
</members>
</doc>
No preview for this file type
No preview for this file type
File added
File added
File added
File added
File added
File added
File added
File added
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment