get all inspected dimensions ?


Hi to all

Here is a little challenge. How to make a macro (or add in) that can collect all of the dimensions marked as inspection and only them from a draft. The outcome should be a table retrieving all the data of the inspection dimensions (value, superfix etc.) and to be exported to xls file. I saw with SEspy that the value “inspection” is either true or false and I guess I should start there.

Must admit my programming skills are more then rusty….

Anyone who can assist is welcome to pick the glove.



I’m using SE V20.






Posted by: alon raviv
Post date: 5/13/2009 12:11:10 PM


RE: get all inspected dimensions ?

Sounds like it would be easy enough to do it all in Excel VBA since Excel is your final destination anyway. Upload an exmaple draft and I'll get you started.


Posted by: Jason Newell
Post date: 5/14/2009 12:21:03 PM

RE: get all inspected dimensions ?



Hi Jason

Thanks for your quick response. I guess it does make sense to import the data needed into excel rather then building a macro in SE to export it- especially when excel is the final result.

I have started writing some of the code yesterday night (see below) and had to open some of my old VB books lol. I understand a loop is needed to call all items (variables) in dimensions. I’m not so clear of how to get the info I need from SE and how to insert it into the excel sheet. I have seen some examples here with getrelated but not quit sure how it works (or if I need it at all). On a different aspect, my initial intention was to collect only the dimensions marked for inspection, but if that is too complicated (coz I’m not sure how to verify this) I guess I can import all dimensions and sort it out on the excel sheet by using the true/false value of inspection.

As for a dft example- any dft with some dimensions mark for inspection will do.

Btw- anyone that has an idea is welcome to comment.



Private Sub CommandButton2_Click()

    Dim objApp As Object

    Dim objActiveDocument As Object

    Dim objActiveSheet As Object

    Dim objDim As Object

    Dim seCount As Long

    Dim objValue As Variant

    Dim seSystemName As String, seValue As Variant, seInspection As Boolean, seSuperFixString As Integer, sePreFixString As String, sePrimaryUpperTolerance As Double, sePrimaryLowerTolerance As Double



    'Get SE object

    Set objApp = GetObject(, "SolidEdge.Application")

    Set objActiveDocument = objApp.ActiveDocument

    Set objActiveSheet = objActiveDocument.ActiveSheet

    Set objDim = objActiveSheet.dimensions

    Call objDim.GetRelatedCount(seCount)  ????????

    MsgBox seCount & "looking for dimensions"

    For i = 0 To seCount - 1


        ' Get the related elements

        Call objDim.GetRelated(seValue, seInspection)

        MsgBox "Item " & ": " & seValue.Value

    Next i


End Sub

 ’ still missing how to insert to excel


Posted by: alon raviv
Post date: 5/14/2009 10:41:01 PM

RE: get all inspected dimensions ?


Here you are an example.

It is a VBA macro inside the Excel file.

It makes a list in Excel for the Inspection dimensions (list position, value, upper tol, lower tol) and mark the SE dimensions with the list position

Open the Excel file and go to Tools -> Macros. You'll find a simple macro called "GetInspectionDims" that you can modify and run




Posted by: Julian Guillo
Post date: 5/15/2009 7:51:37 AM

RE: get all inspected dimensions ?

 Hi Julian I bow in humble. You made it looks so easy, please tell me it took you more then 5 min otherwise my self esteem would be completely crashed.Nice touch with the “Mark the dimension” thingy. It would come very handy.I also saw you didn’t use GetRelated which I spent so long to try and figure out.I guess I still have much to learn about programming.To summaries it in 3 words- “you’re the man” Tusinde tak skal du har.



Posted by: alon raviv
Post date: 5/16/2009 3:24:50 AM

RE: get all inspected dimensions ?



It took me more than 5 min... about 6 or 7  (just kidding)




Posted by: Julian Guillo
Post date: 5/18/2009 4:34:10 AM