Continuously Updating a Drawing Number Register with ilogic and Forms

Continuously Updating a Drawing Number Register with ilogic and Forms

Anonymous
Not applicable
594 Views
2 Replies
Message 1 of 3

Continuously Updating a Drawing Number Register with ilogic and Forms

Anonymous
Not applicable

Hello All,

 

So our company has an issue that I would like to solve through ilogic. I have seen some posts about this but none (that I can find) have been through a detailed discussion on the matter of linking .IDWs and excel to create a drawing number register that stays updated. I have three .IDW iproperties that comprise our drawing number at the moment. Project, Stock Number, Category, and Part Number (in that order) comprise the drawing number. So what I would like to do is take those iproperties, combine them, and export them to Excel to populate our drawing list each time a drawing is created. To be clear, I want each of our designers to be able to click a button in an .IDW form when they create a drawing, and I want that button to export these properties to excel to keep our drawing list up-to-date. If that number has been taken already then I want excel to return an error box stating so.

 

We have had so many issues with designers crossing over each other and pulling the same drawing numbers because they don't keep our manually-typed list updated. I already have the form created and I know how to do that part, just need to get some proper ilogic to do this.

0 Likes
595 Views
2 Replies
Replies (2)
Message 2 of 3

MechMachineMan
Advisor
Advisor

If you just use Inventor API, you could start here:

 

http://modthemachine.typepad.com/my_weblog/2010/02/accessing-iproperties.html

 

Googling "Msdn" will be a good start for string operators.

 

Look into excel API to find the last row/get cell values. (Or write/find a function with iLogic that does the same.

 

Here is an example of iLogic I have used to play with excel in the past:

 

If I were to rewrite it, I would definitely change it to be the route as I described above.

 

Sub Main()
Dim oUser As String
Dim oRevNote As String
Dim oPath As String
Dim oWO As String
Dim Loc As String

oUser = ThisApplication.GeneralOptions.UserName
oRevNote = InputBox("What did you change?", "REV", "")
oPath = ThisApplication.ActiveDocument.FullFileName

Try
oWO = ThisApplication.ActiveDocument.PropertySets.Item("Inventor User Defined Properties").Item("WO#").Value	
Catch
oWO = InputBox("WO Number?","","")
End Try

If oRevNote = ""
	Exit Sub
End If

Loc = "C:\Users\Documents\Excel File Log"
WorkSheet = Loc
Sheetno = ("Sheet1")
' Open excel 
GoExcel.Open(WorkSheet, Sheetno)
' Define Range
oRowStart = 2
oRowEnd = 100
For count = oRowStart To oRowEnd
	' If it's blank count it
	If String.IsNullOrEmpty(GoExcel.CellValue("A" & count)) Then 
		i = i + 1
	End If
Next
' Next empty oRow is max oRows minus blank oRows plus one
oRow = oRowEnd - i + 1
GoExcel.CellValue("A" & oRow) = TimeString
GoExcel.CellValue("B" & oRow) = DateString
GoExcel.CellValue("C" & oRow) = oUser
GoExcel.CellValue("D" & oRow) = oRevNote
GoExcel.CellValue("E" & oRow) = oWO
GoExcel.CellValue("F" & oRow) = oPath
GoExcel.Save

'newExcelApp = CreateObject("Excel.Application")
'newExcelApp.Visible = True
'newExcelApp.Workbooks.Open(Loc)

End Sub

--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 3 of 3

Anonymous
Not applicable

Thanks for the link. I am horrible with writing code but I'm trying to learn...the hardest thing for me is trying to figure out what each line of code is actually doing and figuring out what to write next. This seems like it's going to take a while to figure out. Hopefully more members will come along to help. I will use what you have provided and try to start there. Thanks again.

0 Likes