How to create circular center mark like this with API?
Is it possible in SW2012?
Thanx a lot
Have a look at the API example: 2012 SOLIDWORKS API Help - Automatically Insert Center Marks Example (VBA)
Nilesh, thanx for your reply.But I have already read that, it's not helpful.
I just tried and it works for me, can you run this
Inserts center marks for each view in active sheet
Change "AutoInsertCenterMarks" function options as you wish
Dim swApp SldWorks.Sldworks
Set swApp = Application.SldWorks
Dim swmodel As Sldworks.ModelDoc2
Dim swdraw As SldWorks.DrawingDoc
Dim sh As Sldworks.Sheet
Dim viv As SldWorks.View
Dim boolstat As Boolean
Set swmodel = swApp.ActiveDoc
Set swdraw = swmodel
Set sh = swdraw.GetCurrentSheet
For Each vi In sh.GetViews
Set viv = vi
boolstat = swdraw.ActivateView(viv.Name)
boolstat = viv.AutoInsertCenterMarks(swAutoInsertCenterMarkType_Hole, swCenterMark_ShowBaseCenterMarkLines, True, True, True, 0.0025, True, True, 0)
Hi,Fatih Mehmet Ozcan
Thanx for your reply.
The code could create center mark for sure, but the result is not what I want.
It should be like pic1, but not pic2.
Is it possible to be done with API?
it seems like nobody needs this macro...
Try it,it isn't perfect.
today,I modified it. it is OK
I don't know if it is possible but here might be some helpful sudo code:
user selects the primary center point edge on the drawing
use the api to get the edge
loop over all circular edges in the view
create a unique linear center mark group between each circular edge and the center point edge using
InsertCenterMark3 and swCenterMark_LinearGroup
i think you could then hide the connecting lines by turning off swCenterMark_ShowLinearConnectLines
I appreciate your reply, but I totally have no idea how to start this code.
I will keep looking for the solution, thanks again.
I threw a quick macro together that will hopefully get you started. You'll need to pick the view that you want to place the center marks on before you run it. Also, it's got some limitations - like using the first component it finds in the view to place the center marks on, so you'll probably have to tweak it for your particular requirements. Either way, I hope it helps you get going.
Dennis - Is it possible to get a copy of the part. David Stockdale has a good idea and I'd like to add to it. This macro will be something that I can use in the future.
Retrieving data ...