Ok, so I have a fairly complicated conversion for flat drawings. Essentially, we get drawings from our parent company who have a different laser set-up than we do, so we have to change what items go on which layers and changes colors, etc.
My problem is, I need to add a single point on the part drawing to tell the laser which side is the kept part. It uses this marker to designate where the laser should start cutting( i.e. start inside a hole rather than burn through the part to keep).
I can't find a way to guarantee that I can place a point on a drawing that lands on the part to keep. My current method selects the center point of a bend line and inserts the point there. It works fine, except if the part doesn't have a bend. The fabrication department wants to go back and manually add this, but I've fully automated everything else. Push a button and it runs through all the flats on a build list and converts them.... except this point. I could use the bounding box, but I can't think of anyway to prevent the point being placed inside a hole.
Any help would be appreciated.
*This is only a section of the code where I think this would work best:
Set swDraw = swApp.OpenDoc6(fileName, swDocumentTypes_e.swDocDRAWING, swOpenDocOptions_e.swOpenDocOptions_Silent, "", errors, warnings)
Set swModel = swApp.ActiveDoc
Set swModelDocExt = swModel.Extension
Set swSelMgr = swModel.SelectionManager
status = swDraw.ActivateView("Drawing View1")
status = swModelDocExt.SelectByID2("Drawing View1", "DRAWINGVIEW", 0.104008832128, 0.1163870710783, 0, False, 0, Nothing, 0)
Set swView = swSelMgr.GetSelectedObject6(1, -1)
Set swRootDrawComp = swView.RootDrawingComponent
sLayerName = "layer1" ' MAIN
bRet = swDraw.CreateLayer(sLayerName, "LASER", 4194432, swLineCONTINUOUS, swLW_NORMAL, True): Debug.Assert bRet
swDraw.ChangeComponentLayer sLayerName, False 'True for ALL VIEWS - False for SELECTED VIEW
' instance.CreateLayer2(Layername, LayerDesc, LayerColor, LayerStyle, LayerWidth, BOn, BPrint)
'LINETYPES: swLineCONTINUOUS 0, swLineHIDDEN 1, swLinePHANTOM 2, swLineCHAIN 3, swLineCENTER 4, swLineSTITCH 5, swLineCHAINTHICK 6, swLineDEFAULT 7
'LINE WEIGHTS: swLW_NONE -1, swLW_THIN 0, swLW_NORMAL 1, swLW_THICK 2, swLW_THICK2 3, swLW_THICK3 4, swLW_THICK4 5, swLW_THICK5 6, swLW_THICK6 7
'swLW_NUMBER 8, swLW_LAYER 9, swLW_CUSTOM 10
sLayerName = "layer4" ' BEND LINES
bRet = swDraw.CreateLayer(sLayerName, "BEND", 8404992, swLineHIDDEN, swLW_NORMAL, True): Debug.Assert bRet ' NEED THIS
sLayerName = "layer30" ' LOCATION
bRet = swDraw.CreateLayer(sLayerName, "LOCATE", 65535, swLineCONTINUOUS, swLW_NORMAL, True): Debug.Assert bRet ' NEED THIS
'Drawingview1 is still selected - *I WANT TO ADD THE POINT HERE AT SOME X & Y - this was recorded separately Part should be swModel
Dim skPoint As Object
Set skPoint = Part.SketchManager.CreatePoint(X, Y, 0#)
sLayerName = "layer40" ' ETCHING
bRet = swDraw.CreateLayer(sLayerName, "ETCHING", 4227327, swLineCHAIN, swLW_NORMAL, True): Debug.Assert bRet ' NEED THIS