AnsweredAssumed Answered

Changing the layer of drawing centre marks and dimensions

Question asked by Daniel Martin on Oct 12, 2011
Latest reply on Jun 2, 2015 by Mario Zahren

Hello, I'm trying to automate the drawing of some parts. As part of this I am trying to change the layer of both the dimensions and the centre marks to match my company's standard template. The drawing templates are pre-imported into the drawing, so I would want to change say the centre marks layer from its default to the layer called "CENTRE". So far I have been having no luck. What I think should work is shown below, but it keeps on getting stuck at the GetSelectedObject6 stage. Does anyone have any ideas of what is going on? Am I barking up completely the wrong tree? Will it work if I sort out the GetSelectedObject6 problem or does it need something else.

 

 

Dim Draw As SldWorks.DrawingDoc

Dim swSelMgr As SldWorks.SelectionMgr

Dim swDrawComp As IDrawingComponent

 

boolstatus = Draw.ActivateView("Drawing View2")

boolstatus = Draw.Extension.SelectByID2("DetailItem129@Drawing View2", "CENTERMARKSYM", 0.0664070846066, 0.1201125333933, 0, True, 0, Nothing, 0)

 

Set swSelMgr = Draw.SelectionManager()

Set swDrawComp = swSelMgr.GetSelectedObject6(1, -1)

swDrawComp.Layer = "CENTER"

 

 

Thank you

Outcomes