Hi,
Visual Studio Express can create other types of applications. Take a look at the options on the New Project dialog. I am not sure why you don't want the form. In any case you could use a console application to drive Inventor from the DOS prompt. You may want to consider creating an AddIn that loads and seems like it is part of Inventor. This topic is covered in the Programming help file. Creating AddIns for Inventor 2012 is easier now because the AddIn can be loaded without using the Windows registry.
If you are using the iLogic code snippets, then VB.NET will not know what to do with them and you would need to change the code so it uses standard VB.NET code. Below is how I converted part of the iLogic tutorial to VBA: (VBA is more similar to VB.NET then the iLogic code) Notice how the iLogic "Feature.IsActive=" needs to be something like 'partCompDef.Features("flange_hole").Suppressed =" in the VB code. Also notice how UnitsOfMeasure needs to be used to get the values correct. The API works in specific units, in the API. Length is in centimeters..
You would need to use Events to get the same functionality as a rule. When you work with iLogic you don't have to add an event that watches for the Parameter to change.
Thanks,
Wayne Brill
Autodesk Developer Network
<code_begin>
Private Sub modelEvents_OnParameterChange(ByVal DocumentObject As Document, ByVal Parameter As Parameter, ByVal BeforeOrAfter As EventTimingEnum, ByVal Context As NameValueMap, HandlingCode As HandlingCodeEnum)
'iLogic Rule
'******************************************
'If holes = "flange" Then
'Feature.IsActive("flange_hole") = True
'Feature.IsActive("base_hole") = False
'ElseIf holes = "base" Then
'Feature.IsActive("flange_hole") = False
'Feature.IsActive("base_hole") = True
'ElseIf holes = "none" Then
'Feature.IsActive("flange_hole") = False
'Feature.IsActive("base_hole") = False
'End If
'*******************************************
If BeforeOrAfter = kAfter Then
If Parameter.Name = "holes" Then
Dim partCompDef As PartComponentDefinition
Set partCompDef = ThisApplication.ActiveDocument.ComponentDefinition
If Parameter.Value = "flange" Then
partCompDef.Features("flange_hole").Suppressed = False
partCompDef.Features("base_hole").Suppressed = True
ElseIf Parameter.Value = "base" Then
partCompDef.Features("flange_hole").Suppressed = True
partCompDef.Features("base_hole").Suppressed = False
ElseIf Parameter.Value = "none" Then
partCompDef.Features("flange_hole").Suppressed = True
partCompDef.Features("base_hole").Suppressed = True
End If
End If
If Parameter.Name = "chamfers" Then
' Dim partCompDef As PartComponentDefinition
Set partCompDef = ThisApplication.ActiveDocument.ComponentDefinition
' iLogic rule
'**********************
'If chamfers = True Then
'Feature.IsActive("Chamfers") = True
'ElseFeature.IsActive("Chamfers") = False
'End If
' ******************
If Parameter.Value = True Then
partCompDef.Features("Chamfers").Suppressed = False
Else
partCompDef.Features("Chamfers").Suppressed = True
End If
End If
'iLogic Rule
'*******************************************
' If Mass = 100 Then
' bracket_width = 1
' ElseIf Mass = 200 Then
' bracket_width = 2
' ElseIf Mass = 300 Then
' bracket_width = 3
' ElseIf Mass = 400 Then
' bracket_width = 4
' End If
'*******************************************
If Parameter.Name = "mass" Then
Dim UofM As UnitsOfMeasure
Set partCompDef = ThisApplication.ActiveDocument.ComponentDefinition
Set UofM = ThisApplication.ActiveDocument.UnitsOfMeasure
Dim d1 As Double
d1 = UofM.ConvertUnits(Parameter.Value, kDatabaseMassUnits, kLbMassMassUnits)
Dim d2 As Double
Set partCompDef = ThisApplication.ActiveDocument.ComponentDefinition
If d1 <= 100 Then
d2 = UofM.ConvertUnits(1, kDefaultDisplayLengthUnits, kDatabaseLengthUnits)
partCompDef.Parameters("bracket_width").Value = d2
ElseIf d1 > 100 And d1 <= 200 Then
'bracket_width = 2
d2 = UofM.ConvertUnits(2, kDefaultDisplayLengthUnits, kDatabaseLengthUnits)
partCompDef.Parameters("bracket_width").Value = d2
ElseIf d1 > 200 And d1 <= 300 Then
' bracket_width = 3
d2 = UofM.ConvertUnits(3, kDefaultDisplayLengthUnits, kDatabaseLengthUnits)
partCompDef.Parameters("bracket_width").Value = d2
ElseIf d1 > 300 And d1 <= 400 Then
' bracket_width = 4
d2 = UofM.ConvertUnits(4, kDefaultDisplayLengthUnits, kDatabaseLengthUnits)
partCompDef.Parameters("bracket_width").Value = d2
Else
d2 = UofM.ConvertUnits(6, kDefaultDisplayLengthUnits, kDatabaseLengthUnits)
partCompDef.Parameters("bracket_width").Value = d2
End If
End If
End If
End Sub
<code_end>
Wayne Brill
Developer Technical Services
Autodesk Developer Network