hi,
i need a little help:
i'd like to make 3 separate macros that:
a. selects the green ok check mark when exiting the feature manager after creating/changing a feature
b. clears the merge bodies check box in extrude feature manager
c. links a selected dimension (in an open sketch) to 'thickness' in the link values drop down dialogue box and oks out. (but does not rebuild)
my goal is to have each of the macros linked to a keystroke. i do all three hundreds of times a day and i'd be pretty happy if i could do this stuff with my non mouse hand.
i tried recording macros with no luck, can anyone suggest something?
thanks
SolidworksParts And Features
Probably would be good to post your question in the API sub-forum.
https://forum.solidworks.com/community/solidworks/api
Cheers,
Anna
thanks, i'll do that...
Use the Enter key.
This macro will clear the merge field for the selected features, assuming they are extrude features. Example code only. No error handling or parameter checking. Use at your own risk.
=========
using SolidWorks.Interop.sldworks;
using SolidWorks.Interop.swconst;
using System.Runtime.InteropServices;
using System;
namespace clearmerge.csproj
{
public partial class SolidWorksMacro
{
public void Main()
{
ModelDoc2 md = swApp.ActiveDoc as ModelDoc2;
SelectionMgr selMgr = md.SelectionManager as SelectionMgr;
int selCount = selMgr.GetSelectedObjectCount2(-1);
for (int i = 1; i == selCount; i++)
{
if (selMgr.GetSelectedObjectType3(i, -1) == (int)swSelectType_e.swSelBODYFEATURES)
{
Feature f = selMgr.GetSelectedObject6(i, -1) as Feature;
object featDef = f.GetDefinition();
ExtrudeFeatureData2 featData = null;
featData = f.GetDefinition() as ExtrudeFeatureData2;
featData.Merge = false;
f.ModifyDefinition(featData, md, null);
}
}
}
///
/// The SldWorks swApp variable is pre-assigned for you.
///
public SldWorks swApp;
}
}
================
Can't help you with this one. It's quitting time here.