Autodesk Inventor
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Re: How to use iLogic Rule to delete rules and features in other parts?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi
I just made some changes in there as i needed and its working but one more thing i waana do is delete all parameters
either user parameters or model
Auto = iLogicVb.Automation
Dim iLogicAuto As Object
iLogicAuto = Auto
Dim oDoc As Document
oDoc = ThisApplication.ActiveDocument
'Master file name
If Not (ThisDoc.FileName) = "iLogic" Then
Dim ruleName As String
Dim rules As Object
rules = iLogicAuto.rules(oDoc)
'Remove rules
If Not (rules Is Nothing) Then
For Each rule In rules
ruleName = rule.Name
iLogicAuto.DeleteRule(oDoc, ruleName)
Next
Else
i = MessageBox.Show("No Rules are in File")
End If
Dim oFeatures As PartFeatures
oFeatures = oDoc.ComponentDefinition.Features
Dim oFeature As PartFeature
'Remove suppressed features
For Each oFeature In oFeatures
featureName = oFeature.Name
i = MessageBox.Show("Click Yes to delete all Fetures or No to Suppressed or Cancel to abort", "My iLogic Dialog", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1)
' If Not Feature.IsActive(featureName) Then
If i=vbYes Then
i = MessageBox.Show("Deleting All Features ")
oFeature.Delete
Else If i=vbNo Then
' i = MessageBox.Show("Deleting Supressed Features ")
If Not Feature.IsActive(featureName) Then
oFeature.Delete
End If
Else
i = MessageBox.Show("Action canceled ")
End If
Next
End If
'but now something i wanna do is
'Remove all Parameters too
If Not (param Is Nothing) Then
For Each param In params
i = MessageBox.Show("Checking for Parameter in File")
i = MessageBox.Show("No.of Parameters exists are ="& param.count)
paramname=param.Name
On Error Resume Next
param.delete(oDoc, paramName)
paramName =ThisDoc.Document.ComponentDefinition.Parameters
iLogicAuto.Deleteparam(oDoc, paramName)
Next
Else
i = MessageBox.Show("No Parameter are in File")
'Please help me in the I will be greatful
'Thanks and regards
"vicky
Re: How to use iLogic Rule to delete rules and features in other parts?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
hi dear sir/Buddy.................
A solution u did give earlier to some helped me alot what i wanna achive , Imade some chages according my need
and its working but i wanna little more help from u please......
Auto = iLogicVb.Automation
Dim iLogicAuto As Object
iLogicAuto = Auto
Dim oDoc As Document
oDoc = ThisApplication.ActiveDocument
'Master file name
If Not (ThisDoc.FileName) = "iLogic" Then
Dim ruleName As String
Dim rules As Object
rules = iLogicAuto.rules(oDoc)
'Remove rules
If Not (rules Is Nothing) Then
For Each rule In rules
ruleName = rule.Name
iLogicAuto.DeleteRule(oDoc, ruleName)
Next
Else
i = MessageBox.Show("No Rules are in File")
End If
Dim oFeatures As PartFeatures
oFeatures = oDoc.ComponentDefinition.Features
Dim oFeature As PartFeature
'Remove suppressed features
For Each oFeature In oFeatures
featureName = oFeature.Name
i = MessageBox.Show("Click Yes to delete all Fetures or No to Suppressed or Cancel to abort", "My iLogic Dialog", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1)
' If Not Feature.IsActive(featureName) Then
If i=vbYes Then
i = MessageBox.Show("Deleting All Features ")
oFeature.Delete
Else If i=vbNo Then
' i = MessageBox.Show("Deleting Supressed Features ")
If Not Feature.IsActive(featureName) Then
oFeature.Delete
End If
Else
i = MessageBox.Show("Action canceled ")
End If
Next
End If
'but now something more i wanna do is...... delete parameters
If Not (param Is Nothing) Then
For Each param In params
i = MessageBox.Show("Checking for Parameter in File")
i = MessageBox.Show("No.of Parameters exists are ="& param.count)
paramname=param.Name
On Error Resume Next
param.delete(oDoc, paramName)
paramName =ThisDoc.Document.ComponentDefinition.Parameters
iLogicAuto.Deleteparam(oDoc, paramName)
Next
Else
i = MessageBox.Show("No Parameter are in File")
End If
'Regards
'vicky
Re: How to use iLogic Rule to delete rules and features in other parts?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Removing all Parameters is what I wanna too.
Thanks lot for your contribution, Vicky.
I tested your code, but I do not know what is happened, code cannot get into "For .... Next" Loop.
That means: "If Not (param Is Nothing) Then" gives me "False" although I have lot of parameters in my model. I could use "Delete All Rules and iLogic Parameters" to delete them. But the codes which you provided does not work.
Maybe it is because I am using Inventor 2009 if it is working in your side.
Any does anybody know how to delete suppressed components in *.iam by iLogic code?
Thank, anyhow.
Autodesk Inventor Professional 2013 (64 Bit) SP1.1
Windows 7 Professional Service Pack 1
Intel(R) Xeon(R) CPU E5645
12.0 GB Memory



