×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

3dface/3dsolid/3dpolyline using VB - Need help

3dface/3dsolid/3dpolyline using VB - Need help

3dface/3dsolid/3dpolyline using VB - Need help

(OP)
Here is what I am trying to do:
I have .DWG (from mechanical desktop)files that have both 3D & 2D entities in them. not able to export(step or iges) the complete data out of Mechanical desktop. If I use step, I am losing 2d drawing data. If I use IGES, i am losing 3d data.

I would like to: (through VB )
scan all the .DWG files. If 3D entities are found, export them into STEP. If 2D entities( pure 2d drawing )are found, export them into IGES 2D.

If someone has some sample code for searching entities both in ModelSpace and PaperSpace, please post it here.

If you have some other ideas, please share with me.
Thanks in advance.
y2kmvr

RE: 3dface/3dsolid/3dpolyline using VB - Need help

This is made from some pieces of code I use....no promises.


Public Function Get3dObjects()
'------------------------------------------------------------------------------
'Get3dObjects:
'------------------------------------------------------------------------------
Dim acSelSet As AcadSelectionSet
Dim iCode() As Integer
Dim vValue() As Variant

'''''''''''''''''''''''''''''''''''''''
'--------------------------------------------------------------------------
'Filter set
'--------------------------------------------------------------------------
ReDim iCode(4): ReDim vValue(4)
iCode(0) = -4:  vValue(0) = "<OR"
iCode(1) = 0:   vValue(1) = "3DFACE"
iCode(2) = 0:   vValue(2) = "3DSOLID"
iCode(3) = 0:   vValue(3) = "POLYLINE"
iCode(4) = -4:  vValue(4) = "OR>"

Set acSelSet = GetMultiEntSS(iCode, vValue)

End Function


Public Function GetMultiEntSS(ByVal vFiltType As Variant, ByVal vFiltData As _
Variant) As AcadSelectionSet
'------------------------------------------------------------------------------
'GetMultiEntSS: Select from all entities and return selection set of all items
'               of the type provided
'Arguments:     vFiltType:
'Returns:       AcadSelectionSet
'Example:
'ReDim iCode(3): ReDim vValue(3)
'    iCode(0) = -4:  vValue(0) = "<OR"
'    iCode(1) = 2:   vValue(1) = "SOMEBLOCKNAME"
'    iCode(2) = 2:   vValue(2) = "SOMEOTHERBLOCKNAME"
'    iCode(3) = -4:  vValue(3) = "OR>"
'
'    Set acSS = GetMultiEntSS(intCode, vntValue)
'------------------------------------------------------------------------------
Dim acSelSet As AcadSelectionSet
Dim intMode As Integer
Dim vntFilterType As Variant
Dim vntFilterData As Variant
'''''''''''''''''''''''''''''''''''''''
intMode = 5 'acSelectionSetAll
Set acSelSet = ClearSS("MSSET")

vntFilterType = vFiltType
vntFilterData = vFiltData
acSelSet.Select intMode, , , vntFilterType, vntFilterData
Set GetMultiEntSS = acSelSet
Set acSelSet = Nothing
End Function
Public Function ClearSS(ByVal strName As String) As AcadSelectionSet
'------------------------------------------------------------------------------
'ClearSS:       The input selection set name is deleted from the drawing so
'               that the selection set name can be reused.
'Arguments:     strName - name of selection set to create in the drawing
'Returns:       Returns the selection set, cleared of all items
'------------------------------------------------------------------------------
On Error GoTo ErrHandler

Dim acSelSet As AcadSelectionSet
Dim acSelSets As AcadSelectionSets
'''''''''''''''''''''''''''''''''''''''
Set acSelSets = ThisDrawing.SelectionSets

For Each acSelSet In acSelSets
    If acSelSet.name = strName Then
        ThisDrawing.SelectionSets.Item(strName).Delete
        Exit For
    End If
Next

Set acSelSet = ThisDrawing.SelectionSets.Add(strName)
Set ClearSS = acSelSet
    
ExitHere:
    Exit Function
ErrHandler:
    Debug.Print vbObjectError + 514, "PP_ACAD Error", _
    "Function 'ClearSS' Failed"
End Function

"Everybody is ignorant, only on different subjects." — Will Rogers

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources