Subrotina opensolidworkswithsolver


Dim OSw As SldWorks.SldWorks
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swSketchMgr As SldWorks.SketchManager
Dim swFeatMgr As SldWorks.FeatureManager
Dim swPlane As SldWorks.RefPlane
Dim instance As ICWResults
Dim swStudy As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim swFeature As Object
Dim chordroot As Double
Dim chordtip As Double
Dim lift As Double
Dim x As Double, y As Double, z As Double
Dim envergadura As Double
Dim swSketch As SldWorks.Sketch
Dim partTitle1 As StringSub opensolidworkswithsolver()

chordroot = tempchordroot * 1000
chordtip = tempchordtip * 1000
envergadura = tempenvergadura
lift = indlift
Set OSw = CreateObject("sldworks.Application")
OSw.Visible = True

' Initialize SolidWorks application and active document
Set swModel = OSw.NewDocument("C:\ProgramData\SolidWorks\SOLIDWORKS 2024\templates\Part.prtdot", 0, 0, 0)
Set Part = OSw.ActiveDocpartTitle1 = Part.GetTitle

' Start of the curve with the scale applied (chordroot)
Part.InsertCurveFileBegin
x = 0.001 * chordroot: y = 0 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00095042 * chordroot: y = 0.00001245 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00090089 * chordroot: y = 0.00002398 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00085127 * chordroot: y = 0.00003555 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00080153 * chordroot: y = 0.00004693 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00075163 * chordroot: y = 0.000058 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00070159 * chordroot: y = 0.00006847 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00065139 * chordroot: y = 0.00007809 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00060105 * chordroot: y = 0.00008665 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00055058 * chordroot: y = 0.00009393 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.0005 * chordroot: y = 0.00009974 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00044932 * chordroot: y = 0.00010384 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00039857 * chordroot: y = 0.00010598 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00034778 * chordroot: y = 0.00010587 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.000297 * chordroot: y = 0.00010331 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00024625 * chordroot: y = 0.0000983 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00019558 * chordroot: y = 0.00009066 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00014504 * chordroot: y = 0.0000801 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00009473 * chordroot: y = 0.00006578 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00006973 * chordroot: y = 0.00005667 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00004492 * chordroot: y = 0.0000456 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.0000205 * chordroot: y = 0.00003129 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00000866 * chordroot: y = 0.00002159 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00000418 * chordroot: y = 0.00001634 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00000205 * chordroot: y = 0.00001317 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0 * chordroot: y = 0 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)
boolstatus = Part.InsertCurveFileEnd()
' Início da segunda curva com aplicação da escala (chordroot)
Part.InsertCurveFileBeginx = 0 * chordroot: y = 0 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00000795 * chordroot: y = -0.00001017 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00001082 * chordroot: y = -0.00001214 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00001634 * chordroot: y = -0.00001517 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.0000295 * chordroot: y = -0.00002013 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00005508 * chordroot: y = -0.00002664 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00008027 * chordroot: y = -0.00003123 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00010527 * chordroot: y = -0.00003476 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00015496 * chordroot: y = -0.00003972 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00020442 * chordroot: y = -0.0000429 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00025375 * chordroot: y = -0.0000446 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.000303 * chordroot: y = -0.00004499 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00035222 * chordroot: y = -0.00004407 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00040143 * chordroot: y = -0.00004172 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00045068 * chordroot: y = -0.00003814 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.0005 * chordroot: y = -0.00003356 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00054942 * chordroot: y = -0.00002823 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00059895 * chordroot: y = -0.00002239 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00064861 * chordroot: y = -0.00001629 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00069841 * chordroot: y = -0.00001015 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00074837 * chordroot: y = -0.0000043 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00079847 * chordroot: y = 0.00000083 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00084873 * chordroot: y = 0.00000483 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00089911 * chordroot: y = 0.00000704 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00094958 * chordroot: y = 0.00000651 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.001 * chordroot: y = 0 * chordroot: z = 0 * chordroot
boolstatus = Part.InsertCurveFilePoint(x, y, z)
boolstatus = Part.InsertCurveFileEnd()
' Named view and zoom to fit
Part.ShowNamedView2 "*Trimetric", 8
Part.ViewZoomtofit2
' Create a new sketch on the Front Plane
boolstatus = Part.Extension.SelectByID2("Front Plane", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
Part.SketchManager.InsertSketch True
' Convert each curve to a sketch entity
boolstatus = Part.Extension.SelectByID2("Curve1", "REFERENCECURVES", 0, 0, 0, False, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("Curve2", "REFERENCECURVES", 0, 0, 0, True, 0, Nothing, 0)
Part.SketchManager.SketchUseEdge3 False, False ' Convert curves to sketch entities
' Exit sketch
Part.SketchManager.InsertSketch False
' Start of the curve with the scale applied (chordtip)
Part.InsertCurveFileBegin
x = 0.001 * chordtip: y = 0 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00095042 * chordtip: y = 0.00001245 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00090089 * chordtip: y = 0.00002398 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00085127 * chordtip: y = 0.00003555 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00080153 * chordtip: y = 0.00004693 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00075163 * chordtip: y = 0.000058 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00070159 * chordtip: y = 0.00006847 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00065139 * chordtip: y = 0.00007809 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00060105 * chordtip: y = 0.00008665 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00055058 * chordtip: y = 0.00009393 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.0005 * chordtip: y = 0.00009974 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00044932 * chordtip: y = 0.00010384 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00039857 * chordtip: y = 0.00010598 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00034778 * chordtip: y = 0.00010587 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.000297 * chordtip: y = 0.00010331 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00024625 * chordtip: y = 0.0000983 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00019558 * chordtip: y = 0.00009066 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00014504 * chordtip: y = 0.0000801 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00009473 * chordtip: y = 0.00006578 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00006973 * chordtip: y = 0.00005667 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00004492 * chordtip: y = 0.0000456 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.0000205 * chordtip: y = 0.00003129 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00000866 * chordtip: y = 0.00002159 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00000418 * chordtip: y = 0.00001634 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00000205 * chordtip: y = 0.00001317 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0 * chordtip: y = 0 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
boolstatus = Part.InsertCurveFileEnd()Part.InsertCurveFileBegin
x = 0 * chordtip: y = 0 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00000795 * chordtip: y = -0.00001017 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00001082 * chordtip: y = -0.00001214 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00001634 * chordtip: y = -0.00001517 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.0000295 * chordtip: y = -0.00002013 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00005508 * chordtip: y = -0.00002664 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)x = 0.00008027 * chordtip: y = -0.00003123 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00010527 * chordtip: y = -0.00003476 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00015496 * chordtip: y = -0.00003972 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00020442 * chordtip: y = -0.0000429 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00025375 * chordtip: y = -0.0000446 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.000303 * chordtip: y = -0.00004499 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00035222 * chordtip: y = -0.00004407 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00040143 * chordtip: y = -0.00004172 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00045068 * chordtip: y = -0.00003814 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.0005 * chordtip: y = -0.00003356 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00054942 * chordtip: y = -0.00002823 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00059895 * chordtip: y = -0.00002239 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00064861 * chordtip: y = -0.00001629 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00069841 * chordtip: y = -0.00001015 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00074837 * chordtip: y = -0.0000043 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00079847 * chordtip: y = 0.00000083 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00084873 * chordtip: y = 0.00000483 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00089911 * chordtip: y = 0.00000704 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.00094958 * chordtip: y = 0.00000651 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
x = 0.001 * chordtip: y = 0 * chordtip: z = envergadura * 0.5
boolstatus = Part.InsertCurveFilePoint(x, y, z)
boolstatus = Part.InsertCurveFileEnd()
Set swFeatMgr = swModel.FeatureManager' Create the second plane offset from Front Plane
boolstatus = swModel.Extension.SelectByID2("Front Plane", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
Set swPlane = swFeatMgr.InsertRefPlane(8, envergadura * 0.5, 0, 0, 0, 0) ' Create offset plane 1
' Select the new plane
boolstatus = Part.Extension.SelectByID2(swPlane.Name, "PLANE", 0, 0, 0, False, 0, Nothing, 0)' create a sketch on the selected plane
Part.SketchManager.InsertSketch True' Convert each curve to a sketch entity
boolstatus = Part.Extension.SelectByID2("Curve3", "REFERENCECURVES", 0, 0, 0, False, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("Curve4", "REFERENCECURVES", 0, 0, 0, True, 0, Nothing, 0)
Part.SketchManager.SketchUseEdge3 False, False ' Convert curves to sketch entities
' Exit sketch
Part.SketchManager.InsertSketch False' Create the loft
boolstatus = Part.Extension.SelectByID2("Sketch1", "SKETCH", 0, 0, 0, True, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("Sketch2", "SKETCH", 0, 0, 0, True, 0, Nothing, 0)
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID2("Sketch1", "SKETCH", 0, 0, 0, False, 1, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("Sketch2", "SKETCH", 0, 0, 3, True, 1, Nothing, 0)
Part.FeatureManager.InsertProtrusionBlend False, True, False, 1, 0, 0, 1, 1, True, True, False, 0, 0, 0, True, True, Trueboolstatus = Part.Extension.SelectByID2("PLANE1", "PLANE", 0, 0, 0, False, 0, Nothing, 0)' Create a new sketch
Part.SketchManager.InsertSketch True' Draw a vertical line starting from the origin
Set myLine = Part.SketchManager.CreateLine(0, 0, 0, 0, 0.02, 0)Part.SketchManager.InsertSketch Falseboolstatus = Part.Extension.SelectByID2("Line1@Sketch3", "EXTSKETCHSEGMENT", 0, 1.11584498587677E-02, 0, True, 0, Nothing, 0)
boolstatus = Part.InsertAxis2(True)
boolstatus = Part.Extension.SelectByID2("Sketch3", "SKETCH", 0, 0, 0, False, 0, Nothing, 0)
Part.BlankSketch' Initialize Simulation Add-in
Dim COSMOSWORKSObj As Object
Dim CWAddinCallBackObj As Object
'Necessary to already have a part open with the simulation add-in active!!
Set CWAddinCallBackObj = OSw.GetAddInObject("SldWorks.Simulation")
Set COSMOSWORKSObj = CWAddinCallBackObj.COSMOSWORKSDim motionStudyMgr As Object
Set motionStudyMgr = Part.Extension.GetMotionStudyManager()
Dim ActiveDocObj As Object
Dim StudyManagerObj As Object
Dim LoadsAndRestraintsManagerObj As Object
Dim ErrorCodeObj As Long
Dim ContactManagerObj As Object
Set ActiveDocObj = COSMOSWORKSObj.ActiveDoc()
Set StudyManagerObj = ActiveDocObj.StudyManager()
StudyManagerObj.ActiveStudy = 0
Dim NewStudyName As String
NewStudyName = "Static 1"
Dim CWNewStudy As Object
Set CWNewStudy = StudyManagerObj.CreateNewStudy3(NewStudyName, 0, 0, ErrorCodeObj)
boolstatus = Part.Extension.SelectByID2("Loft1", "SOLIDBODY", 0, 0, 0, True, 0, Nothing, 0)
Dim StudyObj As Object
Set StudyObj = StudyManagerObj.GetStudy(0)
If StudyObj Is Nothing Then
Debug.Print "No no no"
Exit Sub
End If
Dim SolidManagerObj As Object
Set SolidManagerObj = StudyObj.SolidManager()
ErrorCodeObj = SolidManagerObj.SetLibraryMaterialToSelectedEntities("Custom Materials", "E.P.S.")
Part.ClearSelection2 TrueDim x_origin As Double
Dim y_origin As Double
x_origin = (chordroot * 0.001) / 2
y_origin = (chordroot * 0.00009974) / 2' Redraw
Part.GraphicsRedraw2
boolstatus = Part.Extension.SelectByRay(x_origin, y_origin, 0, -0.631634233055523, -0.18531998030324, 0.752791272885631, 8.13551995470029E-03, 2, True, 0, 0)' Redraw
Part.GraphicsRedraw2
Set LoadsAndRestraintsManagerObj = StudyObj.LoadsAndRestraintsManager()
Dim DispatchObj1 As Object
Set DispatchObj1 = Part.SelectionManager.GetSelectedObject6(1, -1)
If DispatchObj1 Is Nothing Then
Debug.Print "Failed to get the selected object. Please ensure the face is selected."
Exit Sub
End If
Dim DispArray As Variant
DispArray = Array(DispatchObj1)
Dim CWRestraintObj As Object
Set CWRestraintObj = LoadsAndRestraintsManagerObj.AddRestraint(0, (DispArray), Nothing, ErrorCodeObj)
Part.ClearSelection2 TrueDim x_origin_tip As Double
Dim y_origin_tip As Double
Dim z_origin_tip As Double
x_origin_tip = (chordtip * 0.001) / 2
y_origin_tip = (chordtip * 0.00009974) / 2
z_origin_tip = envergadura * 0.5
Radius = 0.00009974 / 5'Redraw
Part.GraphicsRedraw2
boolstatus = Part.Extension.SelectByRay(x_origin_tip, y_origin_tip, z_origin_tip, -0.277237907064792, -0.228718182991176, -0.933181191224699, Radius, 2, True, 0, 0)' Redraw
Part.GraphicsRedraw2
boolstatus = Part.Extension.SelectByID2("Axis1", "AXIS", -0.161238928176615, 1.21740934029632E-02, 0.896097347894243, True, 0, Nothing, 0)

Part.GraphicsRedraw2
' Redraw
Part.GraphicsRedraw2
Set LoadsAndRestraintsManagerObj = StudyObj.LoadsAndRestraintsManager()
Set DispatchObj1 = Part.SelectionManager.GetSelectedObject6(1, -1)
Dim ReferenceGeometryDispatchObj2 As Object
Set ReferenceGeometryDispatchObj2 = Part.SelectionManager.GetSelectedObject6(2, -1)
If ReferenceGeometryDispatchObj2 Is Nothing Then
Debug.Print "Failed to get the reference geometry. Please ensure it is selected."
Exit Sub
End If
DispArray = Array(DispatchObj1)

Dim CWForceObj As Object
Dim DistanceValues As Variant
Dim ForceValues As Variant
Dim ComponentValues As Variant
Dim data(6) As Double
data(0) = 1
data(1) = 1
data(2) = lift
data(3) = 1
data(4) = 1
data(5) = 1
ComponentValues = data
Set CWForceObj = LoadsAndRestraintsManagerObj.AddForce3(0, 0, 0, 0, 0, 0, (DistanceValues), (ForceValues), 0, False, 0, 0, 4, 1, (ComponentValues), False, False, (DispArray), ReferenceGeometryDispatchObj2, False, ErrorCodeObj)
CWForceObj.ForceBeginEdit
CWForceObj.SetForceComponentValues 0, 0, 1, 1, 1, lift
CWForceObj.ForceEndEdit
Part.ClearSelection2 TrueDim MeshObj As Object
Set MeshObj = StudyObj.Mesh()
MeshObj.Quality = 1
MeshObj.UseJacobianCheckForSolids = 2
MeshObj.MesherType = 2
MeshObj.MinElementsInCircle = 8
MeshObj.GrowthRatio = 1.4
MeshObj.SaveSettingsWithoutMeshing = False
MeshObj.Unit = 0
ErrorCodeObj = StudyObj.CreateMesh(0, 40, 2)
ErrorCodeObj = StudyObj.RunAnalysis()
Dim ResultsObj As Object
Set ResultsObj = StudyObj.Results()
If ResultsObj Is Nothing Then
Debug.Print , "Failed to get results object"
Exit Sub
End If

Dim Disp As Variant
Dim Stress As VariantDisp = ResultsObj.GetMinMaxDisplacement(3, 1, Nothing, 0, ErrorCodeObj)
Stress = ResultsObj.GetMinMaxStress(9, 0, 1, Nothing, 3, ErrorCodeObj)
StressArray = Stress
DisplacementArray = Disp
Set StudyManagerObj = Nothing
Set ActiveDocObj = Nothing
Set CWAddinCallBackObj = Nothing
Set COSMOSWORKSObj = NothingOSw.CloseDoc partTitle1
End Sub

    Bruna Santos                        Luísa Pessoa                       Frederico Garcia
brunadossantos@ua.pt                l.pessoa@ua.pt                 fredericogarcia@ua.pt
Desenvolvido por Webnode Cookies
Crie o seu site grátis! Este site foi criado com a Webnode. Crie o seu gratuitamente agora! Comece agora