====== iLogic ======
===== Form + save iproperties =====
'https://forums.autodesk.com/t5/inventor-programming-ilogic/change-iproperties-using-form/m-p/11307387#M140420
Public Sub Main()
Dim oDrawDoc As DrawingDocument = ThisDoc.Document
Dim oName As String = "MyPart.ipt"
'//////// RUN THE FORM ////////
Dim oForm As New WinForm(iLogicVb.Automation, oDrawDoc)
oForm.ShowDialog()
iProperties.Value(oName, "Project", "Part Number") = oForm.NewPartNumber
oDrawDoc.Update
End Sub
Public Class WinForm
Inherits System.Windows.Forms.Form
Public Property oDrawDocint As DrawingDocument
Public Property oTextBox As New System.Windows.Forms.TextBox
'//////// CREATE NEW INSTANCE ////////
Public Sub New(ByVal Iinf As IiLogicAutomation,oDrawDoc As DrawingDocument)
oForm = Me
myIinf = Iinf
oDrawDocint = oDrawDoc
'//////// PARAMETERS FOR THE FORM ////////
With oForm
.FormBorderStyle = FormBorderStyle.FixedToolWindow
'.StartPosition = FormStartPosition.CenterScreen
.Width = 250
.Height = 300
.Font = oLargerFont
End With
'//////// CREATES THE BUTTON ////////
Dim oButton1 As New System.Windows.Forms.Button()
With oButton1
.Text = "ACTION"
.Top = ((oForm.Bottom - oForm.Top)/2) - (oButton1.Bottom - oButton1.Top)
.Left = (oForm.Width/2) - oButton1.Width +20
.Enabled = True
.AutoSize = True
End With
Dim oLbl As New System.Windows.Forms.Label
With oLbl
.Text = "MyPart"
.Top = 20
.Left = 20
.Height = 40
End With
With oTextBox
.Text = "Part No."
.Top = 20
.Left = 120
.Width = 100
.Height = 25
End With
oLbl = oForm.Controls.Add(oLbl)
oForm.Controls.Add(oTextBox)
oForm.Controls.Add(oButton1)
AddHandler oButton1.Click, AddressOf oButton1_Click
End Sub
Public Property NewPartNumber As String
Public Sub oButton1_Click(ByVal oSender As System.Object, ByVal oEventArgs As System.EventArgs)
NewPartNumber = oTextBox.Text
Me.Close()
' iProperties.Value(oName, "Project", "Part Number") = oTextBox.Text
End Sub
End Class
===== Polotovar =====
'From https://www.cadlinecommunity.co.uk/hc/admin/articles/203069922
Try
'oHoldingPositionName = InputBox("Specify the N A M E of the new iProperty", "Cadline Community - iProperty Name", "New")
oValue = InputBox("Specify the V A L U E of the new iProperty", "Cadline Community - iProperty Value", "1")
'iProperties.Value("Custom", oHoldingPositionName) = oValue
'iProperties.Value("Custom", "POLOTOVAR") = oValue
iProperties.Value(ThisDrawing.ModelDocument.DisplayName,"Custom", "POLOTOVAR") = oValue
Catch
End Try
If ThisApplication.ActiveDocument.DocumentType <> kDrawingDocumentObject Then
MessageBox.Show("Prosím, spustě toto pravidlo nad VÝKRESem", "iLogic")
Exit Sub
End If
'MessageBox.Show("Bylo spuštěno nad výkresem, DĚKUJI", "iLogic")
Try
oValue = InputBox("Zadej polotovar", "AUTOMA - polotovar", iProperties.Value(ThisDrawing.ModelDocument.DisplayName,"Custom", "POLOTOVAR"))
iProperties.Value(ThisDrawing.ModelDocument.DisplayName, "Custom", "POLOTOVAR") = oValue
ThisDoc.Document.Update
Catch
End Try
'Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument
'Dim oDrawParams As UserParameters = oDrawDoc.Parameters.UserParameters
'Dim TestParam As UserParameter = oDrawParams.AddByValue("TestParam", "InitialValue", UnitsTypeEnum.kTextUnits)
'iLogic code by Clint Brown @ClintBrown3D
'Originally posted at https://clintbrown.co.uk/Drawing_Notes_iLogic
SetNotePath = "C:\TEMP\Notes.txt"
' This assumes a drawing document is active.
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument
' a reference to the active sheet.
Dim oActiveSheet As Sheet
oActiveSheet = oDrawDoc.ActiveSheet
' a reference to the GeneralNotes object
Dim oGeneralNotes As GeneralNotes
oGeneralNotes = oActiveSheet.DrawingNotes.GeneralNotes
Dim oTG As TransientGeometry
oTG = ThisApplication.TransientGeometry
'----------READ IN DATA From TEXT File --------------------
oRead = System.IO.File.OpenText(SetNotePath)
EntireFile = oRead.ReadToEnd()
oRead.Close()
Dim sText As String
sText = EntireFile
'----------READ IN DATA From TEXT File --------------------
Dim oGeneralNote As GeneralNote
'oGeneralNote = oGeneralNotes.AddFitted(oTG.CreatePoint2d(3, 40), sText) 'Top Left
'oGeneralNote = oGeneralNotes.AddFitted(oTG.CreatePoint2d(50, 40), sText) 'Top Right
oGeneralNote = oGeneralNotes.AddFitted(oTG.CreatePoint2d(50, 8), sText) 'Bottom Right
'oGeneralNote = oGeneralNotes.AddFitted(oTG.CreatePoint2d(3, 6), sText) 'Bottom Left
MessageBox.Show("Opravené pravidlo: " & RuleName, "Informace")
Dim objSPVoice,colVoices
objSPVoice = CreateObject("SAPI.SpVoice")
objSPVoice.speak ("gate ley you fucked up again fill in that i property")
objSPVoice.speak ("i am facking awsome")