Drawing Validation

Drawing Validation

mchi_topsoe
Enthusiast Enthusiast
266 Views
3 Replies
Message 1 of 4

Drawing Validation

mchi_topsoe
Enthusiast
Enthusiast

Using the Job processor to publish drawings to our PLM system. 

We have experienced situations where the designer have overseen a missing Design doctor issue,  or a view is not updated. Hence the Job processor produces non-predictable results.

 

Implementing an ilogic script that validates the drawing and stores the result in a custom iProperty: HealthStatus. We then implement a State Change rule in Vault preventing the files from being released unless HealthStatus="OK". 

 

' Get active document
Dim doc As Document = ThisApplication.ActiveDocument

' Initialize HealthStatus as OK
Dim healthStatus As String = "OK"

' Check if document needs migration or an update
Dim issues As String = ""

If doc.NeedsMigrating Then
    issues &= "NeedsMigration | "
End If

If doc.RequiresUpdate Then
    issues &= "RequiresUpdate | "
End If


' Check Design Doctor status using UI button
Try
    Dim ribbons As String() = {"Part", "Assembly", "Drawing"}
    For Each rib In ribbons
        Try
            Dim cmd As ControlDefinition = ThisApplication.UserInterfaceManager.Ribbons.Item(rib).QuickAccessControls.Item("AppDesignDoctorCmd").ControlDefinition
            If cmd.Enabled Then
                issues &= "DesignDoctorIssues | "
                Exit For
            End If
        Catch ex As Exception
            ' Ignore if ribbon is not available
        End Try
    Next
Catch ex As Exception
    ' Ignore errors
End Try

' Check if drawing views are outdated (for drawings only)
If TypeOf doc Is DrawingDocument Then
    Dim drawDoc As DrawingDocument = doc
    For Each oSheet As Sheet In drawDoc.Sheets
        For Each oView As DrawingView In oSheet.DrawingViews
			messagebox.Show(oview.IsUpdateComplete & oView.UpToDate)
If Not oView.UpToDate Then
                issues &= "OutdatedDrawingView | "
            End If
        Next
    Next
End If

' Remove trailing "| " if any issues were found
If issues <> "" Then
    healthStatus = issues.TrimEnd(" |".ToCharArray())
End If

' Update the iProperty "HealthStatus"
Try
    Dim propSet As PropertySet = doc.PropertySets.Item("Inventor User Defined Properties")
    Try
        propSet.Item("HealthStatus").Value = healthStatus
    Catch
        propSet.Add(healthStatus, "HealthStatus")
    End Try
Catch ex As Exception
    ' Ignore errors
End Try

 

Almost working, except that I can not capture the Update View scenario. The icon shows the drawing is not up to date, but neither oview.IsUpdateComplete & oView.UpToDate shows false.

 

Skærmbillede 2025-03-20 085743.png

 

0 Likes
Accepted solutions (1)
267 Views
3 Replies
Replies (3)
Message 2 of 4

WCrihfield
Mentor
Mentor
Accepted solution

Hi @mchi_topsoe.  This is just a quick guess, but you may need to check one additional step deeper.  What I mean is, check if the 'model' that the view references requires an update.  Many times I have seen (manually) where I open a drawing and it has a lot of those little 'update required' icons (next to sheets or views), then I click the main Update tool, and see it do some updates within the drawing.  But then, after those changes (update required icons beside view go away), other update required icons appear next to the model icons.  If I right-click on those, it gives me the option to update the model, so I do that.  Then the views need updating again, so I use the main Update tool button again, to finally be done with updates.  Maybe something like that is going on, and the model needs to be updated.  Again, just a guess.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 4

mchi_topsoe
Enthusiast
Enthusiast

Good point - Normally if the model is up to date, the drawing view will automatically update as well.

In that case, I have to check all referenced files for their state...

Normally it is working fine, but we all know these rare cases where a user have made 3 triple derived and mirrored part with 5 skeleton models. 😉

Then they are surprised when the automatic export doesn't work.

0 Likes
Message 4 of 4

zy19860604
Collaborator
Collaborator

Hi @mchi_topsoe.  Could you share the finally code? We meet the same issue.

Thank you for your help.

0 Likes