Why would you want a macro? You can create a sketch on top of the spline one in a single operation. So in the new sketch you have a line that has the shape of the spline but can no longer be changed.
You can copy this entire shaped curve and insert it into anything without it ever being able to move. You can even create a block of this sketch, so you can use the full figure many times for other projects.
Duration of the operation 3 minutes while pouring the coffee
Thank you for your answer, I downloaded the block file but unfortunately, the sketch remains a spline, I can't do the wrapping with the mechanically welded function.
Sorry to contradict you but the block is not a spline.
In addition, if you don't edit the spline of the block, nothing moves
Maybe something escapes me in your explanation or in what you want to do. What do you mean [quote="Farouk, post:4, topic:108806"] I can't do the dressing with the mechanically welded function. [/quote]
Send you the complete file, I'll give you an example of what I offer you
There are few members of this forum today who have a 2023 version... Can you produce the document in a previous version of SolidWorks? Alternatively, you can export it in IGES format, by checking the options for sketch entities and curves, so as to allow the retrieval of " generic" splines.
The macro doesn't work at home either, nor is the file probably corrupted (impossible to edit it) We will have to find her elsewhere or another who does the same thing.
Your initial sketch is written in a square of 4900 mm on each side. It consists of 938 entities, mainly splines, and a few segments of lines (45). I used the C++ code proposed by Biarc Interpolation - RyanJuckett.com to process this sketch of the " Lions ". Each spline is approximated by arcs of tangent circles, at the rate of N arcs per curve segment, N being even and between 2 and 16. Since each spline has only one segment, the number of features is approximately N x 938. The attached document (SW 2021) includes the basic sketch and 3 3D sketches from the processing, with respectively N = 2, N = 8 and N = 16 arcs per segment.
Finding:
For N = 2 arcs per curve segment, the general pace is 90% correct, but some portions of curves are very badly approximated. This is the case when the curvature of the spline is greatly reduced as it approaches an end (cf. the almost rectilinear rays of the sun in the central part of the sketch).
For N = 8, the shape is closer to the original, with deviations of the order of 5 mm at most. But the number of " arc" entities increases to more than 7500. Is this large number compatible with the use you want to make of this model?
For N = 16, the approximation is very good, but at the cost of 15000 entities (more than 10 min of processing). Is it manageable?
It's up to you to judge the interest of this approximation from the sketches of the attached document. A question: what do you call " mechanically welded cladding", is it realistic given the number of entities in the sketch? If the answer is positive, I will finalize the code...
Hello @m.blt Thank you for your answer, it's great, you're saving my life.
I tried to illustrate the steps of my work on this photo to better understand example of 3D sets (same for a 2D set as sent before) Mechanically welded cladding is the selection of the arcs and lines of the sketches, The choice of the profile that will be bent to the desired shape to form the decoration is chosen according to several criteria Sometimes I make sketches for each profile that is going to be used and other times I make sketches that can have several different profiles.
I have to select segment by segment (arc or line) when I am on the " mechanically welded element " function The number N = 16 seems too large to me (for the selection and for the processing of SolidWorks) is it possible to have the two macros N = 2 and N = 8?
The macro (actually an executable module) is attached, accompanied by an explanation page and a light part document to perform my tests, taking up one of the lions of your initial sketch.
Thank you for your efforts and your very precious help. I tried to launch the application on SolidWorks 2023 and 2022. being the file I wanted to process open and close again, running in administrator mode, the Lion attachment file and another file I get a message saying unknown file
Difference Between Operating in the Development Environment and Operating on the End User's PC... Second attempt with the zip attached. AppliBiArc_1.zip (1.6 MB)
Hello @m.blt I hope you're doing well. I encountered a problem using the conversion application, I try to convert sketches on planes other than the face plane to arc (in green) I get sketches on the face plane (in red). Is it possible to solve the problem?
The "working macro" is in fact the executable proposed in the AppliBiArc_1.zip file attached to message n° 18...
It should only be noted that the source sketch containing the splines must be a 3D sketch. 3D sketches use the SolidWorks global coordinate system, while 2D sketches use a special coordinate system, relative to the sketch plane, which is generally different from the SW global coordinate system. This is the question raised by @Farouk in his latest post, solved simply by converting his 2D sketches to 3D.