• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

property: sw-name file(file name) value returned without extension

  • Thread starter Thread starter Francesco18
  • Start date Start date

Francesco18

Guest
Good morning, I'm a new member and I'm working on mechanical design.
I have the need to report in the table of separate material the full file name of extension (file.sldasm/.sldprt). if I use the property available in the list "sw-name file (file name)" the returned values are without extension.
1- how can I get full filename extension? . . .
2- is it possible to create a new property, which appears in the list of properties, with new functions (for example a sort of "sw-pathfilename" that returns the path of the full file name extension? . . .
Thank you in advance
 
Good morning, following the discussion previously launched, I saw that a way to solve the issue of the new custom property (p.to 2), which returns the path of the full name file extension of the active document, is to use a macro.
I have searched on various sites something already done but I have not found exactly what I look for and, unfortunately, I am unable to modify one or create a new one.
Can someone tell me something already seen or tried? . . .
Thank you in advance
 
option explicit
dim swapp as sldworks.sldworks
dim swmodel as modeldoc2
dim swmodeldocext as modeldocextension
dim swcustprop as custompropertymanager
dim val as string
dim valout as string
dim lretval as long

sub main()
set swapp = application.sldworks
set swmodel = swapp.activedoc
set swmodeldocext = swmodel.extension


set swcustprop = swmodeldocext.custompropertymanager("")
dim nomeesteso as string
dim prop as string
nomeesteso = mid(swmodel.getpathname, instrrev(swmodel.getpathname, "\") + 1)
lretval = swcustprop.add3("nomefile", swcustominfotype_e.swcustominfotext, nomeesteso, swcustompropertyaddoption_e.swcustompropertydeleteandadd)
end sub
 
option explicit
dim swapp as sldworks.sldworks
dim swmodel as modeldoc2
dim swmodeldocext as modeldocextension
dim swcustprop as custompropertymanager
dim val as string
dim valout as string
dim lretval as long

sub main()
set swapp = application.sldworks
set swmodel = swapp.activedoc
set swmodeldocext = swmodel.extension


set swcustprop = swmodeldocext.custompropertymanager("")
dim nomeesteso as string
dim prop as string
nomeesteso = mid(swmodel.getpathname, instrrev(swmodel.getpathname, "\") + 1)
lretval = swcustprop.add3("nomefile", swcustominfotype_e.swcustominfotext, nomeesteso, swcustompropertyaddoption_e.swcustompropertydeleteandadd)
end sub
I'm trying. Thank you.
 
It works perfectly!. . .
Great!
Sorry to take advantage of your availability. . .
If I asked you to have besides the file name. extension also the path (path/filename. extension). . .
 
only one property called pathfilename that returns the path/filename. extension (for example w:\disegni\comm\398\02\398.02.001.sldprt) thanks endless
 
option explicit
dim swapp as sldworks.sldworks
dim swmodel as modeldoc2
dim swmodeldocext as modeldocextension
dim swcustprop as custompropertymanager
dim val as string
dim valout as string
dim lretval as long

sub main()
set swapp = application.sldworks
set swmodel = swapp.activedoc
set swmodeldocext = swmodel.extension


set swcustprop = swmodeldocext.custompropertymanager("")
dim nomeesteso as string
dim prop as string
nomeesteso = mid(swmodel.getpathname, instrrev(swmodel.getpathname, "\") + 1)
lretval = swcustprop.add3("nomefile", swcustominfotype_e.swcustominfotext, nomeesteso, swcustompropertyaddoption_e.swcustompropertydeleteandadd)
lretval = swcustprop.add3("pathfilename", swcustominfotype_e.swcustominfotext, swmodel.getpathname, swcustompropertyaddoption_e.swcustompropertydeleteandadd)
end sub
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top