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?
Sketch Point Import Macro Mod
-
- Posts: 321
- Joined: Thu Mar 11, 2021 8:38 am
- x 48
- x 390
Re: Sketch Point Import Macro Mod
I feel like you'd have to transform the coordinates to the reference coordinate system with something like: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?
https://help.solidworks.com/2019/englis ... ple_VB.htm
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.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?
-
- Posts: 98
- Joined: Thu Mar 18, 2021 11:19 am
- Location: St. Louis, MO
- x 288
- x 56
Re: Sketch Point Import Macro Mod
Here is another example on CS transformation, from CodeStack:
https://www.codestack.net/solidworks-ap ... transform/
https://www.codestack.net/solidworks-ap ... transform/
Austin
Re: Sketch Point Import Macro Mod
@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.
Thanks,
Artem
xarial.com - making your CAD better
codestack.net - SOLIDWORKS API macros and tutorials
Artem
xarial.com - making your CAD better
codestack.net - SOLIDWORKS API macros and tutorials