|
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 |
|