Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic Error Check

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Anonymous
1655 Views, 3 Replies

iLogic Error Check

Hello all!

 

I put together a configurator with iLogic and I wanted it to check for errors before allowing save. I was using the following code to do this:

Format:HTML Format Version:1.0 StartHTML: 165 EndHTML: 5886 StartFragment: 314 EndFragment: 5854 StartSelection: 314 EndSelection: 314SyntaxEditor Code Snippet

For Each oFeature As PartFeature In ThisDoc.Document.ComponentDefinition.Features
If oFeature.HealthStatus <> HealthStatusEnum.kUpToDateHealth Then
Question = MessageBox.Show("Errors were found in crossmember, suppress errors?", "Notice!",MessageBoxButtons.YesNo,MessageBoxIcon.Exclamation)
    If Question = vbYes Then
        oFeature.Suppressed = True
    Else If Question = vbNo Then
        MessageBox.Show("Please review crossmember", "Notice!",MessageBoxButtons.OK,MessageBoxIcon.Exclamation)
    End If
End If
Next

 

 This code works great, except it considers suppressed features as errors. Is there another way to check for errors, or something to add to this code so that it will accept suppressed features?

 

Thanks!

3 REPLIES 3
Message 2 of 4
Curtis_Waguespack
in reply to: Anonymous

Hi DanielPenner,

 

You could check for those with kSuppressedHealth first and skip those.

 

Also just as a tip, you can search and ask programming questions of this type on the Inventor Customization forum too:
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

Message 3 of 4
Anonymous
in reply to: Curtis_Waguespack

Hey Curtis, so I put kSuppressedHealth in my code and I works. The onle problem is it runs my "SaveAs" Sub for each feature. I'm pretty sure I'm missing something I just cant seem to figure out what.

 

 

Sub Main

InventorVb.DocumentUpdate()


For Each oFeature As PartFeature In ThisDoc.Document.ComponentDefinition.Features
If oFeature.HealthStatus = HealthStatusEnum.kSuppressedHealth  Or oFeature.HealthStatus = HealthStatusEnum.kUpToDateHealth Then
    SaveAs
Else Question = MessageBox.Show("Errors were found in crossmember, suppress errors before saving?", "Notice!",MessageBoxButtons.YesNo,MessageBoxIcon.Exclamation)
    If Question = vbYes Then
        oFeature.Suppressed = True
        SaveAs
    Else If Question = vbNo Then
        MessageBox.Show("Please review crossmember", "Notice!",MessageBoxButtons.OK,MessageBoxIcon.Exclamation)
    End If
End If
Next

End Sub

 

Message 4 of 4
Curtis_Waguespack
in reply to: Anonymous

Hi DanielPenner,

 

Give this version a try.

 

Also just as a tip, you can search and ask programming questions of this type on the Inventor Customization forum too:
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

Sub Main

InventorVb.DocumentUpdate()
Dim bHealthy As Boolean
bHealthy = True 'use true as defaut

'precheck
For Each oFeature As PartFeature In ThisDoc.Document.ComponentDefinition.Features
	If oFeature.HealthStatus = HealthStatusEnum.kSuppressedHealth Then
		'do nothing
	Else If oFeature.HealthStatus <> HealthStatusEnum.kUpToDateHealth Then
		bHealthy = False
		Exit For 'found unhealthy so exit
	End If
Next

'work with unhealthy features
If bHealthy = False Then
	Question = MessageBox.Show("Errors were found in crossmember, suppress errors before saving?", _
	"Notice!",MessageBoxButtons.YesNo,MessageBoxIcon.Exclamation)
	
	If Question = vbYes Then
		For Each oFeature As PartFeature In ThisDoc.Document.ComponentDefinition.Features
			If oFeature.HealthStatus = HealthStatusEnum.kSuppressedHealth Then
				'do nothing
			Else If oFeature.HealthStatus <> HealthStatusEnum.kUpToDateHealth Then
				oFeature.Suppressed = True
			End If
		Next
		'do save as here
	End If
Else 'bHealthy is True 
	'do save as here
End If


End Sub

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report