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

button to add "x45°"

  • Thread starter Thread starter cop1
  • Start date Start date
So? Renamed to "45.vbs" works?
Good morning vespa_83
I send you 2 images of the prceding that I follow.
by notepad ++ select "Save with name" ->45.vbs.
I then try to add the macro in solidedge, choosing *.*, but the file, while being seen, is not added to the list.
Copticsim-1.webpim-2.webp
 
in the st5 I am noticing now that you can add any file only in the 'fast access' tab.
If you want to put it in the tape, you need an exe.
I have just an exe program (which I had already done for wsf type files) that launches the file with the same name, I modified it so this looks and launches the .vbs with the same name

evidence:
1. launches the 45.vbs file with double click from explorer, does the macro work?
2. If yes, try with 45.exe attached, put it in the same path of 45.vbs

Hi.
 

Attachments

in the st5 I am noticing now that you can add any file only in the 'fast access' tab.
If you want to put it in the tape, you need an exe.
I have just an exe program (which I had already done for wsf type files) that launches the file with the same name, I modified it so this looks and launches the .vbs with the same name

evidence:
1. launches the 45.vbs file with double click from explorer, does the macro work?
2. If yes, try with 45.exe attached, put it in the same path of 45.vbs

Hi.
Great!
I did some experiments before I responded: Everything works wonder!
launching the vbs appeared to me, in addition to the 45th also a strange character, so I replaced that line with:suffix = "x 45%dg"Now I could also load the macro (with the .exe program that also works with other macros) and the quota bar is much more comfortable (I added other prefixes and suffixes we use habitually). Only little mole is that when you click on the button, you see for a moment the dos screen.
Thank you very much for the help you gave me... and I hope I didn't steal too much time for your hobbies!!
Coptics
 
Well, I'm happy! Anyway, lunch break is not a hobby:-)
I developed several macros for work, so between the acquired technique and the copy-paste between the scripts (always with a minimum of order optics and reuseability), in these things I put more time to read and write on the forum than to find solutions :-)
Good job.
 
for some healthy personal pride I tried to spulciate with the utility "com object browser" fields and here is the macro in less than an hour:

save the content in a file named e.g.: "dftprefissosuffisso.vbs"
the name is customizable, the extension is always .vbs
from customizing the controls of the ribbon bar, add an icon, macro section,..... (usual procedure),... select type: "all files (*.*)" or similar.
Code:
' dftprefissosuffisso.vbs
' gianluca vespignani 19/06/2013 
' cambia prefisso suffisso
' scritto con notepad ++ : \linguaggio\vb

const sedimension = 488188096

call main()

' il codice che segue può essere incollato su vba-excel per ulteriori sviluppi
sub main()

	dim prefisso ' as string
	dim suffisso ' as string
	dim sovrascrivi

	' prefisso e suffisso impostati dall'utente
	prefisso = ""
	suffisso = "x 45°"
	sovrascrivi = true ' attenzione cancella e sovrascrive se i campi = "" 

	dim objapp 'as solidedgeframework.application
	dim objdoc 'as solidedgedraft.draftdocument
	dim objsel 'as solidedgeframework.selectset

	dim objlist 'as ...
	dim objitem 'as ...

	' create/get the application with specific settings
	'on error resume next
	set objapp = getobject(, "solidedge.application")
	objapp.visible = true
	if err then
		err.clear
		msgbox ("prima apri solid edge!!!")
		'set objapp = createobject("solidedge.application")
		'set objdoc = objapp.documents.add("solidedge.draftdocument")
		'call objdoc.close
		'set objdoc = objapp.documents.open(filedft)
		'objapp.visible = true
		' todo: verificare se sono nell'ambiente draft o terminare con exit sub
	else
		set objdoc = objapp.activedocument
	end if
	on error goto 0   'rigestisce gli errori

	' get the active selection
	set objsel = objapp.activeselectset
	if objsel.count < 1 then
		msgbox ("selezionare almeno una quota.")
		exit sub
	else
		for each objitem in objsel
			' filtra gli oggetti seleziona e restituisci solo le quote
			if objitem.type = sedimension then
				'campi:
				if sovrascrivi or prefisso <> "" then
					objitem.prefixstring = prefisso
				end if
				if sovrascrivi or suffisso <> "" then
					objitem.suffixstring = suffisso
				end if
				' campi di tipo string utilizzabili, tested by "com object browser"
				'.superfixstring = "apice" (string)
				'.subfixstring = "pedice" (string)
				'.subfixstring2 = "pedice2" (string)
			end if
		next
	end if


	' release objects
	set objapp = nothing
	set objdoc = nothing
	set objsel = nothing
	' msgbox("finito.")
end sub
Good morning I copied this macro in vb2008express and works, I added the console window so I can type the prefix or suffix I want. I would like to understand where the constants are drawn and how the command works. Is it possible to create a context menu that depending on the affected entity can activate a special menu?
Thank you.
 
excuse but if you have to use the console window or put a drop-down menu seen is already in solidedge, it would take a window full of buttons so choose with a single click, or from console, you list various possibilities (departments mapped to a txt) and the user type the number option and sends.

in the sdk guide of solidedge type sedimension and look for the definitions of the resters (they are numbers, the writing ifdimension is the meaning), but do first with sespy (I speak below).
for the guide on a command, selections on the vs2008 ide you're interested in and first f1: should open the solidedge guide already on the right page.

I no longer find the reference site where to download "com object browser" which also works with word, excel.
"com object browser" shows only properties and fields in read-only (so it is more compact and I find it better).
alternatively download http://www.jasonnewell.net/products/solid-edge-spy.html that allows you to edit the fields.
You must know how to move between .activedocument, .activeselectset and items, then you go that you fly!
 
you would like a list in the drop-down menu. while in the console menu I insert the suffix I need at the moment.
for now I'm in the experimental phase I'm learning how everything works.
Thank you.
 
I have created a menu with list of prefixes and suffixes and I have also inserted the pedice2 I would like to know how to set the pedice2 centered on the quota, I think I have found the constant but I do not know how to apply it should be this :solidedgeconstants.subfixalignmentconstants.sesubfixaligncenter.
Thank you.
 
constants are fixed numbers.
using vs2008 I think you can recall the library and reference solidedgeconstants.subfixalignmentconstants.sesubfixaligncenter
(while write if there is self-completion, then it should work).
or use in direct numbers, see references in the guide:
sesubfixaligncenter =1
sesubfixalignleft =0
sesubfixalignright =2

then:
myquota.subfixalignment = 1
' or:
myquota.solidedgeconstants.subfixalignmentconstants.sesubfixaligncenter
 
depends on the context, somehow it must be declared.
If for example you are recycle my code of this post, then your interest rate is declared with the object: "objitem"
inside the construct "for each objitem in objsel".
read like this: given a previously declared "objsel" set (set obj.sel = objdoc.activeselectset),
for each object, which from now on I want to call "objitem", of the "objsel" set executes such instructions.
example: for each alunno of the whole class, or for each fruit of the set cassette, for each pico_pallo of the set people selected run ....
 
Unfortunately I can't find the right syntax to perform the modification operation pedice position.
 
try to post the code or a portion of it.

I tried it yesterday if there is a selected quota
Code:
sub quicktest()
set objapp = getobject(, "solidedge.application")
set objsel = objapp.activeselectset
miaquota = objsel(1) ' index elemento della selezione corrente: 0 or 1 ?
miaquota.subfixalignment = 1 ' 1:centrato
end sub
 
questa è la parte di codice interessata non funziona. . .

objsel = objapp.activeselectset
if objsel.count < 1 then
msgbox("selezionare almeno un quota.")
exit sub
else
for each objitem in objsel
' filtra gli oggetti seleziona e restituisci solo le quote
if objitem.type = sedimension then
quotasel = objsel(1)
quotasel.subfixalignment = 1
objitem.subfixstring2 = pedice2
end if
Next
end if
 
proof questo:
Code:
objsel = objapp.activeselectset
if objsel.count < 1 then
 msgbox("selezionare almeno una quota.")
 exit sub
else
 for each objitem in objsel
  ' filtra gli oggetti selezionati e processa solo le quote
  if objitem.type = sedimension then
   objitem.subfixstring2 = pedice2
   objitem.subfixalignment = 1 ' centrato
  end if
 next
end if
 

Forum statistics

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

Members online

No members online now.
Back
Top