Some macros

Hello everyone,

It's been a few weeks that I've been working on a Macro that does a lot of things for us,

Basically, SolidWorks asks us for the reference of an axis that we define and then it draws it for us and builds it with the dimensions defined in the Macro, then opens a drawing and dimensions the part with the tolerances requested, but I have some small problems because I don't have any training in APIs.

I can't force it to a 2:1 scale on the MEP and I can't afford to tolerate the diameters.

There are 3 diameters next to it, two of which will always have the same value and the last one which is the customer diameter.

The diameters are never in the same places on the plan because the part is different each time.

If anyone knows the piece of text that can be used to give me a scale or on the side of the diameters I'm all ears.

 

Thank you all and sincere greetings

Hello

Why not put the basemap at this scale??? Like all the pieces you will put in it Auron this ladder. 

1 Like

Hello

For sheet scaling: http://help.solidworks.com/2016/English/api/sldworksapi/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.ISheet~SetScale.html

For the dimensioning of the diameters, I will play with the "mark for drawing" parameter when generating the 3D and then the object insertion function of the model. It should simplify macro processing.

1 Like

Hello

First of all, thank you for your answers,

Then I'm going to try for the background,

And for the dimensioning of the diameters I don't really understand how you want to do it.

But since the drawing is it possible to side specifically this and that diameter? Even if their place in the drawing is different each time? A bit of Macro like that will help me a lot.

I also tried to sketch 3 segments (with the macro), to position them where my diameters are and to give them dimensions equal to those expected on the plan.

But the size of the customer Ø changes quite often while I have defined it as follows:

Set SkLine = Part.SketchManager.CreateLine(-O/2, 0.06, 0, O/2, 0.06, 0)

O being my variable for the Øclient

Dimensioning objects on the drawing seems more complicated to me than setting up the 3D model and then using only what is necessary to make the plan.

Insertions objects of the model: http://help.solidworks.com/2016/english/api/sldworksapi/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IDrawingDoc~InsertModelAnnotations3.html

Marking a dimension for drawing:

http://help.solidworks.com/2016/english/api/sldworksapi/solidworks.interop.sldworks~solidworks.interop.sldworks.idisplaydimension~markedfordrawing.html