-
Re: Use Macros to Import Points from Excel
Peter Simpson Sep 2, 2010 7:35 PM (in response to Zohrab Janessian)I have an awesome excel spreadsheet with options to import points or lines to 2d or 3d sketches.
I will attatch it.
2 points to note.
You need a part open before you use it, and do a fit to screen / zoom extents before assuming it hasnt worked!
Rgds
Pete
-
Points lines through xyz V3.xls 40.5 KB
-
Re: Use Macros to Import Points from Excel
Zohrab Janessian Sep 3, 2010 1:36 PM (in response to Peter Simpson)thanks alot.. this is exactly what i was looking for. Now the next thing I need to do is create a surface using the imported points.
I have the solidworks file attached with all the points. I did a surface fill but it doesnt come out the way it should...
-
Surface.SLDPRT.zip 109.0 KB
-
-
Re: Use Macros to Import Points from Excel
John Lhuillier Dec 10, 2010 3:16 PM (in response to Peter Simpson)This spreadsheet is not only awsome, it is totally awsome & just saved a ton of time not having to enter the points manually. The only thing I can see that would make it better would be the ability to create a spline thru the 3d or 2d points. I know you can do that with insert curve thru XYZ points but to use it you then have to convert the entity into a new sketch. Thanks again Pete
-
Re: Use Macros to Import Points from Excel
Steve Ray Jul 12, 2012 11:04 AM (in response to Peter Simpson)Peter,
I love your macro to import points. How do I control the units being used. My spread sheet is in mils but when it comes into the sketch (which is set to mils) the points are placed using mm.
Steve
-
Re: Use Macros to Import Points from Excel
Sharif Patel Apr 30, 2015 8:37 AM (in response to Peter Simpson)Very very very good excel, thanks a lot, god bless you
-
Re: Use Macros to Import Points from Excel
Carlos Guevara Nov 16, 2015 5:14 PM (in response to Peter Simpson)Hi , how would I use this as a macro,do I have to import it into VBA and save as swp?
-
Re: Use Macros to Import Points from Excel
Jackie Yip Nov 17, 2015 4:46 AM (in response to Carlos Guevara)1.) Have a part opened up in SolidWorks
2.) Open Up Excel document and add/modify points
3.) When finished, click on button and go back into SolidWorks document
Note: Edit Sketch and Press F if you do not see sketch
-
-
Re: Use Macros to Import Points from Excel
Michael Yellowhair Jun 26, 2016 3:54 PM (in response to Peter Simpson)This works great! I was wondering if you have one that will work in inch values? I didn't realize it was metric and inputted inche values. Thanks
-
Re: Use Macros to Import Points from Excel
Deepak Gupta Jun 29, 2016 3:21 PM (in response to Michael Yellowhair)Here is inch one but it might be little off as I've taken the factor as 1 m = 39.3701 in
Updated to a factor of 1 m = 39.3700787401575 in
-
Re: Use Macros to Import Points from Excel
Kendra Wardlow Aug 8, 2018 3:21 PM (in response to Deepak Gupta)You are wonderful as usual, Deepak Gupta
Thank You
-
-
-
Re: Use Macros to Import Points from Excel
Mustafa Baskan Nov 16, 2016 8:40 AM (in response to Peter Simpson)Hi Peter,
This macro has been useful to plot a 3d sketch, which is driven by a XYZ table from our customers. The only thing I couldn't work out is how to add fillets between each line segment.
I tried to record a macro by manually adding sketch fillets to each point, however, when I run the macro, it doesn't work.
Kind regards,
Mustafa
-
Re: Use Macros to Import Points from Excel
Lachit Saikia May 1, 2018 7:22 AM (in response to Peter Simpson)It is really a very helpful macro. I import few coordinates using this macro and place rods there. Now I need to rotate few of the rods at certain polar angle. Is there any way to incorporate the angles into this macro or otherwise to achieve rotation of rods in solidworks?
-
Re: Use Macros to Import Points from Excel
Matteo Buonfiglioli Jul 27, 2018 7:17 AM (in response to Peter Simpson)Great Work
-
-
Re: Use Macros to Import Points from Excel
Deepak Gupta Sep 2, 2010 10:39 PM (in response to Zohrab Janessian)You can also use Curve Through XYZ Points
-
Re: Use Macros to Import Points from Excel
Ganesh K C Oct 7, 2011 3:25 PM (in response to Deepak Gupta)sir i imported points using curve through xyz points. but am not able to use the curve for further design. am new to solidwork pls help me how to use imported curve. am designing involute spur gear. i imported involute coordinates. i got the curve but not able to use it.
-
Re: Use Macros to Import Points from Excel
Deepak Gupta Oct 7, 2011 3:32 PM (in response to Ganesh K C)Welcome to SolidWorks forums Ganesh.
What exactly is hurting you to use the curve??
You might also find this post helpful for your future reference
-
Re: Use Macros to Import Points from Excel
Jerry Steiger Oct 7, 2011 9:07 PM (in response to Ganesh K C)Ganesh,
Curves are sometimes a little strange in SW. It may be that you will need to make a sketch and then Convert Entities on your curve to put a spline in your sketch.
Jerry Steiger
-
-
Re: Use Macros to Import Points from Excel
Ganesh K C Oct 8, 2011 7:52 AM (in response to Deepak Gupta)sir i can import coordinates into solid works. then i made a entity from the imported curve. but once i do this the system slows down and not responding often. am not able to make circular array after that. solidworks not responding after doing this. am unable to make a gear due to this problem.
-
Re: Use Macros to Import Points from Excel
Deepak Gupta Oct 19, 2011 11:02 AM (in response to Ganesh K C)What is the number of points you importing in. And what are the system details/specs you using.
-
Re: Use Macros to Import Points from Excel
Bernd Theunis Oct 20, 2011 2:21 AM (in response to Deepak Gupta)atm i got 100 points. Using SW 2012 proffesional
-
-
-
-
Re: Use Macros to Import Points from Excel
Lope Timajo Sep 2, 2010 10:43 PM (in response to Zohrab Janessian)Yes. You can use curves through xyz but you have to convert your excel files to txt first.
-
Re: Use Macros to Import Points from Excel
Bernd Theunis Oct 19, 2011 9:45 AM (in response to Zohrab Janessian)Hi,
I am new to this forum and I was hoping someone could help me with a problem. I start using the macro in the excel sheet. And it worked perfectly.
We are a engineering company and my main job atm is to build a sound barrier next to a highway. We work in x,y,z ( thats why the excel sheet is a perfect macro to set the center points in the part.)
However... at some point when iam almost done, a client call's me and telling me that the, for example, the first 10 x,y,z, are different because of .... whatever...In what way is it easy to set those points to new x,y,z, without destroying my assembly. My idea was to get the points that were created with the excel sheet, to a design table. But the design table doesn't recognize the points. I could use auto dimension to set the points from the origin point. But i have a minimum of 150 points. To much to use the auto dimension manually.
I also could use table driven pattern..but that's only in x,y....and i need the z-coord for my work.
Summery: I would like the points created from the excel sheets in a way that i can control the points from a excel.
Hope i made my story clear!
Best Regards,
Bernd
-
Re: Use Macros to Import Points from Excel
Hannah Mac Jul 6, 2012 10:44 AM (in response to Bernd Theunis)If you ever figured out the solution to this problem I'd be very interested to hear.
-
-
Re: Use Macros to Import Points from Excel
Ali Arslan Nazan Aug 19, 2014 12:38 PM (in response to Zohrab Janessian)Hello All
I have tried these methods but the results are same.
"The data in this file may be invalid. C:\Users\...."Could you help me for this purpose?I have attached the files.(I took a export on CSV and after that translate it to TXT)
-
svamder.csv.zip 643 bytes
-
svamder.txt.zip 468 bytes
-
Re: Use Macros to Import Points from Excel
Steen Winther Jun 13, 2018 11:44 PM (in response to Ali Arslan Nazan)I know this is old, but someone may be having the same issue. When saving Excel as a TXT-file, depending on operating system etc., it matters which encoding is used. Text files saved directly from Excel gives import errors in Solidworks on my Windows 10 system, but when I open in Notepad and save with ANSI-encoding, it works fine...!
-
-
Re: Use Macros to Import Points from Excel
Jackie Yip Jul 30, 2015 4:42 PM (in response to Zohrab Janessian)OMG! This Macro would be awesome if I could get it to run. But everytime I click on one of the buttons, I get a message that says Compile error: Can't find project or library. I do have a part opened up and running SolidWorks 2015.
-
Re: Use Macros to Import Points from Excel
Jackie Yip Aug 7, 2015 11:54 AM (in response to Jackie Yip)EDIT: I got it to work but the 2D doesn't work out for some reason. No worries can just put in zeros for the column.
-
Re: Use Macros to Import Points from Excel
Javier Davila Jan 17, 2016 5:13 PM (in response to Jackie Yip)Hello Jackie Yip,
How did you make it work? im still having a hard time finding out how to make it work.
Thanks
-
Re: Use Macros to Import Points from Excel
Shayne Wright Jan 24, 2016 12:48 AM (in response to Javier Davila)Just found this thread and yes the macro is awesome and works great for the 3D options, but I believe there is a line of code that is missing from the VBA macro for the 2D point and line options. If you edit the excel macro and add the line it will work.
For the Create 2D Points macro "Private Sub btnTest_Click()" and the missing line below
......
Part.ClearSelection2 True
Part.Extension.SelectByID2 "Front Plane", "PLANE", 0, 0, 0, False, 0, Nothing, 0 '****** MISSING IN ORIGINAL MACRO ****
Part.InsertSketch
Part.SetAddToDB True
.....
Then for the Create 2D Lines
"Private Sub CommandButton1_Click()" Add the same line
Part.Extension.SelectByID2 "Front Plane", "PLANE", 0, 0, 0, False, 0, Nothing, 0 '****** MISSING IN ORIGINAL MACRO ****
Before the Part InsertSketch line and everything should work great. Thanks again to the original post by Peter
-
-
-
-
Re: Use Macros to Import Points from Excel
Jackie Yip Sep 29, 2016 11:37 AM (in response to Zohrab Janessian)Hello,
This macro still works great but if your using Windows 10, I believe the trick is to create a design table and select this file instead and it'll work. Tried doing it outside of SWX and kept getting an error where it didn't know a part was opened up, but inserting it as a design table did the trick.
-
Re: Use Macros to Import Points from Excel
Deepak Gupta Sep 29, 2016 3:40 PM (in response to Jackie Yip)It could be related to macro references.
I'll try to check on a Win 10 tomorrow.
-
Re: Use Macros to Import Points from Excel
Alex Graziani Jun 25, 2018 6:29 PM (in response to Deepak Gupta)Hi Deepak,
Running this macro in SolidWorks 2017 seems to throw an error with the Part.SetToDB True.
Any ideas?
Thanks,
-
Re: Use Macros to Import Points from Excel
Deepak Gupta Aug 8, 2018 3:25 PM (in response to Alex Graziani)Hi Alex, sorry for missing out your post. Are you still having issues with the file?
-
Re: Use Macros to Import Points from Excel
Frank Faulkenberg Oct 4, 2018 2:49 PM (in response to Deepak Gupta)-
Re: Use Macros to Import Points from Excel
Deepak Gupta Oct 5, 2018 1:46 AM (in response to Frank Faulkenberg)Frank, update/correct the macro references to your SOLIDWORKS version as suggested here Fix-Update SOLIDWORKS Macro References? (don't worry on the fact that video is for fixing missing library error but check the process to update your macro library) and that should fix your issue. If not then do revert back.
-
-
-
-
-
-
Re: Use Macros to Import Points from Excel
Mustafa Baskan Oct 9, 2018 9:34 AM (in response to Zohrab Janessian)Hi All,
I am still trying to figure out how to add code for adding fillets to each of the points on the 3D sketch. I tried to record macro and copy that into this macro, but it didn't work. Please help.
-
Re: Use Macros to Import Points from Excel
Raja Annapooranan Feb 12, 2019 9:44 PM (in response to Zohrab Janessian)Super handy. Love this community!