Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

How do you zero flattened sheet metal on drawing? 1

Status
Not open for further replies.

dmeyers

Mechanical
Dec 8, 2005
16
0
0
US
I have my sheet metal part designed in SolidWorks that needs to be converted into a DXF to be read into the machine for production. Currently I take the model, make a drawing of it displaying only the flat pattern and then covert that into a DXF. My question is this - is there any way to set the bottom left corner of the flat pattern window so that it sits exactly at the bottom left corner of the drawing sheet? Reason being - if that can be done I would not have to set my 0,0 point each time I load the DXF into the machine.

Thanks in advance.
 
Replies continue below

Recommended for you

I've ran into the same problem, but never found a solution. I think that what dmeyers is trying to do is make sure the bottom-most and left-most edges are coincident with the 0,0 of the drawing for export to .dxf so that CNC software has no offset when nesting. I have an a-sized sheet where I put a flat pattern view with (Hide All Types) that I export to DXF 1:1 and have to re-open in AutoCad (because DWGEditor isn't as much fun to use) and align with the 0,0.

Any ideas

Matt
Electro Industries, Inc.
 
I don't think there's an easy way to line your model edges up with the sheet origin. I think this could be done with a macro if you do it often. If it's only on occasion then I would bite the bullet and do it in DWGEditor or ACAD.
 
ElectroMatt is correct. I'm actually relaying this issue from a client of ours and it is something that they run into on a daily level. Even with a macro how could you define the the edges are lined up perfectly if they are not selectable/defineable?
 
Without actually trying it myself, I would approach it as follows:

1. Place a sketch point of some sort in the drawing view of interest, constraining it to be at the desired 0,0 point of the part
2. Select this point and run the macro.

The macro would have the following steps:

1. Determine sheet x/y of the selected point
2. Determine SW's x/y location of the view on the sheet
3. Move view by amount of x/y coordinates of the point
4. Lock view position
5. (Optional?) Hide sketch point so it doesn't export

Of course, if the model's origin is not at the desired 0,0 point then the macro will have to be run again immediately prior to export.
 
Here's a starting point. I couldn't find a way to lock view position through API.

Code:
Dim swApp As SldWorks.SldWorks
Dim swDoc As SldWorks.ModelDoc2
Dim boolstatus As Boolean
Dim myNote As SldWorks.Note
Dim myAnnot As SldWorks.Annotation
Dim SelMgr As SldWorks.SelectionMgr
Dim myView As SldWorks.View
Dim myDwgDoc As SldWorks.DrawingDoc
Dim CurViewPos As Variant
Dim PointPosOnSheet As Variant
Dim mySelData As SldWorks.SelectData

Sub main()

Set swApp = Application.SldWorks
Set swDoc = swApp.ActiveDoc
Set myDwgDoc = swDoc
Set myView = myDwgDoc.ActiveDrawingView
CurViewPos = myView.Position

Set SelMgr = swDoc.SelectionManager
Set mySelData = SelMgr.CreateSelectData
If SelMgr.GetSelectedObjectType3(1, -1) <> 11 Then
    MsgBox "Select a sketch point and run macro again"
    Exit Sub
End If

'This seemed like the easiest way to get location
'of the point in sheet space
Set myNote = swDoc.InsertNote("DummyText")
If Not myNote Is Nothing Then
   myNote.Angle = 0
   boolstatus = myNote.SetBalloon(0, 0)
   PointPosOnSheet = myNote.GetAttachPos
   Set myAnnot = myNote.GetAnnotation
   myAnnot.Select3 False, mySelData
   swDoc.EditDelete
Else
    MsgBox "Failed to create note for some reason"
    Exit Sub
End If
CurViewPos(0) = CurViewPos(0) - PointPosOnSheet(0)
CurViewPos(1) = CurViewPos(1) - PointPosOnSheet(1)
myView.Position = CurViewPos

swDoc.ClearSelection
swDoc.WindowRedraw

End Sub
 
What Ive done previously was to use a macro to parse the actual 2d entities out of the drawing view, and get a "bounding box" for the entities.Then Id write my own dxf file, offseting the location of the entities by the lower left corner of the bounding box.

This also allowed me to output a more compatible dxf (no Header section, etc) that some CAM packages choke on.
 
Status
Not open for further replies.
Back
Top