• 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

cop1

Guest
Hello everyone,
I would like to create a button that adds the suffix "x45°" to the portion that select: Does anyone know how to do it?
Thank you.
Coptics
 
in the draft environment there is the bevel quaota that does it automatically
Yes, it is.
but I would like to have the opportunity to add this suffix if I mistakenly quoted with automatic quotation, or in old drawings that I find in archive. I would also like to understand the mechanism to expand the quotation bar.
greetings
Coptics
 
There are several ways to jump a few steps, so it doesn't seem convenient to make a macro.
when you open the window for the prefix/suffix, if you click on the suffix and scroll with the wheel you will re-propose the last writings you used recently.
If you select so many quotas before changing the suffix, apply the change to multiple quotas.
within the same draft and sheet you can also use the attribute copy (type and/or prefix).
 
I did not understand how you would like to expand the quota bar. Tell me?
I believe having one or more dedicated workshops each to add a certain prefix/postfix combination to the quota. for example I touch the quota, then I press the button and the cad adds "x45°", or "n.4 to 90°", or things like that. It's something that would be convenient to me, but I don't think it's possible. It would be faster than opening two or three menus in sequence as you have to do now.
 
I believe having one or more dedicated workshops each to add a certain prefix/postfix combination to the quota. for example I touch the quota, then I press the button and the cad adds "x45°", or "n.4 to 90°", or things like that. It's something that would be convenient to me, but I don't think it's possible. It would be faster than opening two or three menus in sequence as you have to do now.
you can only do with a macro
 
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
 
Like family, ortho and hobbies? ;
Something like that.... At present my free time I mainly dedicate it to the racing bike, but for someone else the hobby can be programming. It's a purely subjective fact! :smile:
 
Something like that.... At present my free time I mainly dedicate it to the racing bike, but for someone else the hobby can be programming. It's a purely subjective fact! :smile:
Ah a bitumaro!

All I'm planning in the summer is for mtb:finger:
 
Thank you vespa_83!
I tried to launch the macro from excell and it works perfect but... I ask vein... I tried to save it from notespad++ as "45.vb" and it doesn't work: mad:
Is it because I have a x64 version? Are there any other solutions?
Coptics
 
then, in the meantime try with vbs extension and not vb (as I wrote above).
I have a 64bit, too.
if it does not go on the 64 bit then you have to run the script through c:\windows\syswow64\wscript.exe
But we'll talk about it tomorrow, but I don't think it's necessary.

Hi.
 

Forum statistics

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

Members online

No members online now.
Back
Top