Page 1 of 1

Sketch Point Import Macro Mod

Posted: Wed Aug 11, 2021 9:24 am
by dave.laban
Probably one for Artem but just in case anyone else knows how:

I want to create a sketch with a bunch of known points (that I already have in CSV format) so this macro is pretty much perfect.

However rather than using the global coordinate system, I was hoping to use a coordinate system I have inserted to define the origin for where the points are placed. Can this macro be modified to prompt me to select a different coordinate system?

Also less critically, my data is natively in mm where the macro requires metres. Obviously it is trivial to update the source data but it would be one less step if maybe the macro could read the document units and import as that, would that be possible?

Re: Sketch Point Import Macro Mod

Posted: Wed Aug 11, 2021 2:34 pm
by AlexB
dave.laban wrote: Wed Aug 11, 2021 9:24 am However rather than using the global coordinate system, I was hoping to use a coordinate system I have inserted to define the origin for where the points are placed. Can this macro be modified to prompt me to select a different coordinate system?
I feel like you'd have to transform the coordinates to the reference coordinate system with something like:
https://help.solidworks.com/2019/englis ... ple_VB.htm
dave.laban wrote: Wed Aug 11, 2021 9:24 am Also less critically, my data is natively in mm where the macro requires metres. Obviously it is trivial to update the source data but it would be one less step if maybe the macro could read the document units and import as that, would that be possible?
Yes, this would be relatively simple to create a conversion function that looks for common units and applies a conversion to any measurements during the import of all the points from your CSV. Meters is such an uncommon unit that you would likely have to convert units anyway.

Re: Sketch Point Import Macro Mod

Posted: Wed Aug 11, 2021 2:57 pm
by Austin Schukar
Here is another example on CS transformation, from CodeStack:

https://www.codestack.net/solidworks-ap ... transform/

Re: Sketch Point Import Macro Mod

Posted: Thu Aug 19, 2021 5:48 am
by artem
@dave.laban, I have updated the original macro and you can now pre-select coordinate system to import points relative to. And you also have an option to import points using the current document coordinate system. I have updated the macro and you can redownload from CodeStack. Please let me know if you have any questions.