Trang chủ
Giới thiệu
Tìm kiếm
1
Automation Studio 5.0 Full Crack
107 lượt xem
2
Harris's shock and vibration handbook
27 lượt xem
3
Autodesk Autocad 2007 Full Crack
15 lượt xem
4
lisp tạo thước đo góc
5 lượt xem
5
test hypertext 3333
4 lượt xem
Tài liệu học thuật
Phần mềm kỹ thuật
App script
Autodesk
Office
Matlab
Modelica
Đăng nhập
Tìm kiếm
Từ khóa tìm kiếm
mô phỏng
inventor
ilogic
vba
autocad
autolisp
cad/cam
nosine
Đăng nhập
-
Đăng ký
Có
8
bài viết
Có
0
bình luận
Trang chủ
Danh mục
Tài liệu học thuật
Phần mềm kỹ thuật
App script
Autodesk
Office
Matlab
Modelica
Trang
Giới thiệu
ilogic
(
2
bài viết)
2025-07-25
iLogic tính một số thông số đặc trưng hình học
Dim doc = ThisDoc.Document Dim oCD As ComponentDefinition = doc.ComponentDefinition Dim oCommandMgr As CommandManager = ThisApplication.CommandManager ' Chọn mặt phẳng Dim oFace As Face = oCommandMgr.Pick(SelectionFilterEnum.kPartFacePlanarFilter, "Chọn mặt phẳng phẳng") If oFace Is Nothing Then Exit Sub ' Tạo sketch trên mặt phẳng đã chọn Dim oSk As PlanarSketch = oCD.Sketches.Add(oFace) oSk.Edit() ' Thực thi lệnh ProjectCutEdgesCmd oCommandMgr.ControlDefinitions("SketchProjectCutEdgesCmd").Execute() ' Lấy profile và tính diện tích, các momen quán tính Dim oProfile As Profile = oSk.Profiles.AddForSolid Dim dArea_cm2 As Double = oProfile.RegionProperties.Area Dim adPrincipalMoments(2) As Double oProfile.RegionProperties.PrincipalMomentsOfInertia( _ adPrincipalMoments(0), _ ' Ix (Moment quán tính quanh trục X) adPrincipalMoments(1), _ ' Iy (Moment quán tính quanh trục Y) adPrincipalMoments(2)) ' Ixy (Moment quán tính chéo) ' Tìm giới hạn x và y từ các điểm sketch Dim minX As Double = Double.MaxValue Dim maxX As Double = Double.MinValue Dim minY As Double = Double.MaxValue Dim maxY As Double = Double.MinValue For Each pt As SketchPoint In oSk.SketchPoints If pt.Geometry.X < minX Then minX = pt.Geometry.X If pt.Geometry.X > maxX Then maxX = pt.Geometry.X If pt.Geometry.Y < minY Then minY = pt.Geometry.Y If pt.Geometry.Y > maxY Then maxY = pt.Geometry.Y Next ' Tính tọa độ trọng tâm (centroid) và chuyển đổi sang mm Dim centroid As Point2d = oProfile.RegionProperties.Centroid Dim cX_cm As Double = centroid.X Dim cY_cm As Double = centroid.Y Dim cX_mm As Double = cX_cm * 10 Dim cY_mm As Double = cY_cm * 10 ' Tính diện tích Dim dArea_mm2 As Double = dArea_cm2 * 100 ' cm² → mm² ' Tính khoảng cách từ trọng tâm đến điểm xa nhất theo trục X và Y Dim maxDistX As Double = Math.Max(Math.Abs(maxX - cX_cm), Math.Abs(minX - cX_cm)) * 10 ' Đoạn đường xa nhất theo trục X (mm) Dim maxDistY As Double = Math.Max(Math.Abs(maxY - cY_cm), Math.Abs(minY - cY_cm)) * 10 ' Đoạn đường xa nhất theo trục Y (mm) ' Tính các momen quán tính theo mm² và mm⁴ Dim Ix_mm4 As Double = adPrincipalMoments(0) * 10000 ' cm⁴ → mm⁴ Dim Iy_mm4 As Double = adPrincipalMoments(1) * 10000 ' cm⁴ → mm⁴ ' Tính momen kháng uốn Wx và Wy Dim Wx_mm3 As Double = Ix_mm4 / maxDistY ' mm³ Dim Wy_mm3 As Double = Iy_mm4 / maxDistX ' mm³ ' Hiển thị kết quả trong hộp thoại MsgBox ("Diện tích: " & Round(dArea_mm2, 2) & " mm²" & vbCrLf & _ "Tọa độ trọng tâm: (" & Round(cX_mm, 2) & ", " & Round(cY_mm, 2) & ") mm" & vbCrLf & _ "Khoảng cách từ trục trung hòa:" & vbCrLf & _ "- Tới điểm xa nhất theo trục X: " & Round(maxDistX, 2) & " mm" & vbCrLf & _ "- Tới điểm xa nhất theo trục Y: " & Round(maxDistY, 2) & " mm" & vbCrLf & _ "Ix: " & Round(Ix_mm4, 2) & " mm⁴" & vbCrLf & _ "Iy: " & Round(Iy_mm4, 2) & " mm⁴" & vbCrLf & _ "Wx: " & Round(Wx_mm3, 2) & " mm³" & vbCrLf & _ "Wy: " & Round(Wy_mm3, 2) & " mm³", vbInformation, "iLogic Đặc trưng hình học:")
25-07-2025
1
0
0
2025-07-25
iLogic xuất tệp step hàng loạt
' iLogic: Xuất toàn bộ .ipt và .iam trong thư mục hiện tại sang STEP ' Đã kiểm chứng chạy ổn trên Inventor 2022 Dim rootFolder As String = ThisDoc.Path Dim stepFolder As String = rootFolder & "\_step" ' Tạo thư mục nếu chưa tồn tại If Not System.IO.Directory.Exists(stepFolder) Then System.IO.Directory.CreateDirectory(stepFolder) End If ' Lấy danh sách file .ipt và .iam Dim files = System.IO.Directory.GetFiles(rootFolder, "*.ipt") files = files.Concat(System.IO.Directory.GetFiles(rootFolder, "*.iam")).ToArray() ' Thiết lập tùy chọn STEP Dim ctx As NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap() Dim oOptions As NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap() Dim oContext As TranslationContext = ThisApplication.TransientObjects.CreateTranslationContext() oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism Dim oSTEP As TranslatorAddIn Dim i As Integer For i = 1 To ThisApplication.ApplicationAddIns.Count If ThisApplication.ApplicationAddIns.Item(i).ClassIdString = "{90AF7F40-0C01-11D5-8E83-0010B541CD80}" Then oSTEP = ThisApplication.ApplicationAddIns.Item(i) Exit For End If Next If oSTEP Is Nothing Then MessageBox.Show("Không tìm thấy STEP Translator.", "Lỗi") Return End If If Not oSTEP.Activated Then oSTEP.Activate() ' Lặp qua từng file và xuất ra STEP For Each filePath In files Try Dim doc As Document = ThisApplication.Documents.Open(filePath, False) Dim docName As String = System.IO.Path.GetFileNameWithoutExtension(filePath) Dim outputFile As String = stepFolder & "\" & docName & ".stp" Dim oData As DataMedium = ThisApplication.TransientObjects.CreateDataMedium() oData.FileName = outputFile oSTEP.SaveCopyAs(doc, oContext, oOptions, oData) doc.Close(True) Catch ex As Exception MessageBox.Show("Lỗi với file: " & filePath & vbCrLf & ex.Message, "Lỗi") End Try Next MessageBox.Show("Xuất STEP hoàn tất!", "Thành công")
25-07-2025
2
0
0