几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » SolidWorks二次开发
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


回复
 
主题工具 搜索本主题 显示模式
旧 2009-04-12, 05:43 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】can i import points data from excel

can i import points data from excel?
howdy! i'm a solid work rookie and would like to know can i get some points datum in excel into solidworks.
i measured some points position with a laser tracker. now i want to analyze the lines and planes formed by these points. how can i get these data into solidworks and analyze them? or solidworks is not the right tool to do this kind of analysis?
insert, curve, curve through xyz points.
tips for working with this tool:
open an existing curve file. click browse and navigate to a curve file to open. you can open .sldcrv files or .txt files that use the same format as .sldcrv files. you can also create 3d curves in microsoft excel for example, save them as .txt files, then open them in solidworks. create a file containing coordinate values for curve points using a text editor or worksheet application. the file format must be a three-column, tab, or space-delimited list of only x, y, and z coordinates. do not include any column headings, such as x, y, and z or other extraneous data
deepak gupta
sw2007 sp5.0
sw2009 sp2.1
you can write a quick macro to create the points for you....
like open solidworks, make a new part and leave it on that screen, from excel vba do the following...
sub main()
dim part as object
dim selmgr as object
dim boolstatus as boolean
dim longstatus as long, longwarnings as long
dim feature as object
'this code starts sw from excel
set swapp = createobject("sldworks.application")
set modeldoc = swapp.activedoc
name = modeldoc.gettitle
'sets the window the model will be created in
set part = swapp.activatedoc2(name, false, longstatus)
set worksheet = worksheets("points") 'where points is name of sheet you are on...
with worksheet
part.insert3dsketch
finalgrid = .cells(65536, 3).end(xlup).row + 1
i = 2
do while i < finalgrid
part.createpoint2 .cells(i, 3).value, .cells(i, 4).value, .cells(i, 5).value
i = i + 1
loop
end with
end sub
that should run through the list of x,y,z coords that you have and make a 3d sketch with all the points in it of that....
column 3 = x points
column 4 = y points
column 5 = z points
oh yeah, sw internal units is millimeters, so if you have inches you might want to convert if you plan on scaling and such...
make sure to add the solidworks reference under tools in excel so it know what commands it needs to run...
edited: 02/11/2009 at 01:32 pm by adam hodge
thank you for the reply! it's very easy. however, when sw reads in the datum, it fits a curve automaticly. i cannot access to the points other than the two ends. how to change the curve back into points?
thank you for the detailed reply! i never used vba before, so can you give me more instruction?
i saved your script as a macros and change the " worksheets("points")" into "worksheets(1)" where i put my data. i ran it; nothing seems happen. what should i do?
and the "column 3 = x" points part, do you mean column a = x ? how to add the sw reference under tools in excel?
lots of beginer questions hehe. expecting your reply.
worksheets("points") refers to the name of the sheet the points are on. basically, replaced points with the name of the tab your data is on in excel.
example:
worksheets("sheet1")
this is be the default 1st sheet in a brand new excel file.
to add the reference, when in the macro editor (alt-f11 opens it) click the following
tools > references
then find the ones that say
solidworks 2007 constant type library
solidworks 2007 commands type library
place a check mark next to them and hit ok. (i have version 2007, this number will vary with what version you have)
finally, the column refers to what colum your data is in, column 3 in rc format is 3, or normal excel format would be column c. the vba references everything by column number not letter.
this program also has a header row for it, so it will start adding points at row 2 and continue until there is either no more rows (65,534 points) or no more points (any number up to 65,534 points)
that should get you to add the points to solidworks. it will be in a single 3d sketch, if you wanted, you can make a new sketch for each point, but solidworks will get slow after you have a couple thousand sketches..
quick
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭

相似的主题
主题 主题发起者 论坛 回复 最后发表
关于cdmis to excel转换的问题 huangyhg PC-DMIS 0 2009-04-07 03:25 AM


所有的时间均为北京时间。 现在的时间是 03:54 AM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多