Block modify when inserted with vba

Hello

I insert a block on a point with VBA (Macro), but my block is completely modified, it's quite annoying.

 

Here's how I insert my block:

        PointCoords(0) = 0.01
        PointCoords(1) = 0.024
        PointCoords(2) = 0 ' Z
       
        Set swMathPoint = swMathUtility.CreatePoint(PointCoords)
        Set swSktBlkDef = swSktManager.MakeSketchBlockFromFile(swMathPoint, "Path to block", False, 1, 0)

 

What I get:

What I'd like:

 

(I specify that if I insert directly manually it's good, but as soon as I make the macro work I get the first result even if I insert it manually).

 

Ps: I'm on SolidWorks 2013

Hello

Did you get this macro from the Macro Recorder?

Yes and no, I also searched on forums.

 

The macro recorder gives me this:

Dim myBlockDefinition As Object
Set myBlockDefinition = Part.SketchManager.MakeSketchBlockFromFile(Nothing, "Path to block", False, 1, 0)

 

So he puts it on me anywhere. But the result is identical to my first image. So what I don't want.

Does your block need to be editable later? 

Do you have different blocks according to the values of Ra?

Hello

Tried digging with the help on this method: http://help.solidworks.com/2015/english/api/sldworksapi/solidworks.interop.sldworks~solidworks.interop.sldworks.isketchmanager~makesketchblockfromfile.html

 

Especially in terms of remarks.

See you.

>> Does your block need to be editable in the future? 

Not necessarily

 

>> Do you have different blocks according to the values of Ra?

Yes, but I still want to insert the Ra 3.2

 

>>Tried to dig with the help on this method: http://help.solidworks.com/2015/english/api/sldworksapi/solidworks.interop.sldworks~solidworks.interop.sldworks.isketchmanager~makesketchblockfromfile.html

I currently use this method, in the remarks they just talk about layer, I didn't understand this point very well.

 

Thank you for your help

I have the impression that there are a lot of bugs with the special characters in the blocks

My proposal: Since Ra 3.2 must always remain, why not create an "image" block in order to keep the special characters that are not modified? Then we can insert this image into a block and insert editable fields. Thus the bloc remains united

Yes it can be a good idea, but I'm afraid of a big drop in quality when making an image. (Finally is there an automatic way to do it with solidworks or do I have to do it via a screenshot?)

I don't know at all... however, it is possible to scale the software more, take a screenshot, and then reduce the magnification factor in SW; The reduced image will thus be of better quality

I tested by taking a screenshot.

But even with the largest possible size, I get mediocre quality. So this solution is not an option.

I just tried to redo my block in another way, at first glance it works but I'm really not sure

1 Like

Is the quality poor on special characters or on writing?

Could you tell us your differences between the blocks? In case other users have the same problem

The image quality so everything (because I did a global capture) is not good.

And my solution didn't work at all... I keep looking.

And using layers that could be frozen via macro?

A few answers of this type were mentioned a few days ago on the subject below:

http://www.lynkoa.com/forum/3d/afichier-un-texte-dans-le-fond-de-plan-suivant-le-nom-de-la-page

 

I don't know how it could work.

Maybe I'll specify what exactly it will be used for:

 

In my company the basemaps have been updated, (Smaller handwriting, etc.) I took care of making a macro that updates the basemap (by reloading it).

Second, the old general tolerance is larger, and it is not updated with the basemap. So I want to make a macro to insert the new one.

 

[edit]

I think the main problem is that the block loses the links (because I have a link between the text and the Ras which are later deleted), then I have the problem of the font sizes, but in theory if I do everything in order I shouldn't have this problem.

Well no solution found (And for almost a year I gave up on it :p)