Message 1 of 2
Find all holes in idw and set their layer through VBA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Just as the title states. I want to change the layer of every hole in an idw to the holes layer. This idw will iterate through a factory and export to individual files that will then be imported into another program for the machines to make the parts. My code is long, so I will place the portion that I am working on:
If createProgram = "Y" Then oMemberProgramTemplate = oRow.Item(iProgramTemplateColumnIndex).Value If Len(Dir(templatesfileLocation & oMemberProgramTemplate & ".idw")) > 0 Then 'get the drawing template Set oDrawingDoc = ThisApplication.Documents.Open(templatesfileLocation & oMemberProgramTemplate & ".idw") Set oSheet = oDrawingDoc.ActiveSheet Dim oHoleLayer As Layer oHoleLayer = oDrawingDoc.StylesManager.Layers.Item("holes") 'get the drawing view Dim oViewDin As DrawingView For Each oViewDin In oSheet.DrawingViews Select Case oViewDin.Name Case "ALPHA" Call oViewDin.ReferencedDocumentDescriptor.ReferencedFileDescriptor.ReplaceReference(ipartsfileLocation & oMemberFile) 'Dim oHoles As HoleFeatures oViewDin.IsRasterView = False Case Else End Select Next 'save copy as one new idw using the member name in the prints folder Call oDrawingDoc.SaveAs(printsfileLocation & oMemberName & ".dwg", True) Call oDrawingDoc.Close End If End If
As you can probably see I am changing the view in the select statement, and it is here I believe the holes should be found and the layer set. I have already created a variable, oHoleLayer, that I need to apply to the holes. Size of the holes do not matter, the importing program will detect the size, I just need to tell the program to drill those holes by setting them to that layer.