Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

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

Status
Not open for further replies.

y2kmvr

Aerospace
Oct 17, 2004
14
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
 
Replies continue below

Recommended for you

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor