几何尺寸与公差论坛------致力于产品几何量公差标准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-13, 10:48 AM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】exportflatpatternview api function

exportflatpatternview api function
hi, when i use the function "export flat pattern view dwg/dxf" in solidworks 2008 sheet metal enviroment, in the prompt windows to save file is possible to check/uncheck the option "remove bend lines". i had write this routine in vb.net:
dim swapp as sldworks.sldworks
dim part as modeldoc2
dim boolstatus as boolean
dim docspec as documentspecification
dim current_model as modeldoc2
'******************************************
'** funziona ma lascia le linee di piega **
swapp = getobject(, "sldworks.application")
docspec = swapp.getopendocspec(file_name)
docspec.documenttype = swdocumenttypes_e.swdocpart
current_model = swapp.opendoc7(docspec)
part = swapp.activedoc
boolstatus = part.exportflatpatternview("c:\ajeje.dxf", 1)
part = nothing
swapp.closedoc(file_name)
'*******************************************
the file "ajeje.dxf" is created correctly in c:\, but in the drawing there are the bend lines. is it possibile to set any option that remove the bend lines (similar to solidworks enviroment)?
thank's and sorry for my bad english
dim swapp as object
dim part as object
dim selmgr as object
dim boolstatus as boolean
dim longstatus as long, longwarnings as long
dim feature as object
sub main()
set swapp = application.sldworks
set part = swapp.activedoc
set selmgr = part.selectionmanager
boolstatus = part.extension.selectbyid2("flat-pattern1", "bodyfeature", 0, 0, 0, false, 0, nothing, 0)
boolstatus = part.exportflatpatternview("c:\flat pattern - part1.dxf", 1)
part.clearselection2 true
end sub
*************
these are my codes and they work perfect.
deepak gupta
sw2007 sp5.0
sw2009 sp2.1
thank's, now i test it...
the code work! but the bend lines are showed in the dxf file!
my question is : is it possible remove bend lines for flatpattern to dxf via api?
thank's
on my machine they are not coming up in the dxf. no sure what are erro on your machine.
replace this line:
boolstatus = part.exportflatpatternview("c:\flat pattern - part1.dxf", 1)
with
boolstatus = part.exportflatpatternview("c:\flat pattern - part1.dxf", 0)
and check.
deepak gupta
sw2007 sp5.0
sw2009 sp2.1
the option in function exportflatpatternview isn'u used (api documentation). if i put 0 or 1 the result are the same, the blend lines are setting via registry:
[hkey_current_user\software\solidworks\solidworks 2008\export settings]
"dxf/dwg remove bend lines for flatpatterntodxf"=dword:00000001
i think that option is settable from code, but i don't find the option in the api documentation...
the option is not currently settable by sw api code but if you set the registry directly by code then it may work depending on when sw reads the registry values at the time of exporting or just at startup
thank's!!!
if i change the registry value, it's necessary to restart sw because sw read the registry setting at startup.
some registry settings are read on-demand so i'd still check if it works by changing the setting and not restarting sw you may find it does.
thank's...i wait your response!
hi riccardo,
i once tried to do the same thing get the macro to hide the bend lines, but i never was able to figure it out. what i did was make a template where in the view menu up top i just went hide all anotation and then save the template and get the macro to use that template to make the dxf files, run the macro and there will be no bend lines no nothing. that way you don't have to mess with the registy. hope this helps.
solidworks 2006,2007,2008,2009 (office premium.)
core 2 duo e6850 @ 3.00 mhz
window xp pro sp3 32 bit
ati firegl v7350
edited: 09/03/2008 at 05:44 pm by ben guenther
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】is there an api function to end the current active command yang686526 SolidWorks二次开发 0 2009-04-12 09:30 PM
【转帖】is there an api function to end the current active command yang686526 SolidWorks二次开发 0 2009-04-12 06:45 PM
【转帖】外挂开发中的封包技术 huangyhg vc编程 0 2007-12-03 04:41 PM
OpenCSG-1.0.2 sample yogy vc编程 2 2007-07-22 04:43 PM
【转帖】对于hook函数的一点认识 huangyhg vc编程 0 2007-03-27 11:53 AM


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


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