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

connect *.prt with excel sheet, here's how

  • Thread starter Thread starter arimans
  • Start date Start date

arimans

Guest
Hello everyone,

Since I am always asking, this time I write something I discovered and that can be very useful, connect a excel sheet with a model *.prt.
in order to do so, you must have the aax form.

1) prepare the model (e.g. a cylinder) rename the size you need, e.g. the size d1 in "height_cylinder"

2) Enter the parameters:
- height type number, value per e.g. 100
-regen_input type yes/no, value no

3) in the reports write:

"height_cylinder=height"

4) choose tool-->program-->edita program. in the text file between "input" and "end input" insert:

"if regen_input = yes
height number
end if

here will be declared the parameters we want to be able to connect to the excel sheet, in this case the parameter "height".

5) in the config.pro must be added the mapkey:

map The ya ~ command `procmdmmparams` ;\
mapkey(continued) ~ columnselect `relation_dlg` `paramsphlay.partable`1 `name`;\
mapkey(continued) ~ arm `relation_dlg` `paramsphlay.partable`2 `rowregen_input` `name`;\
mapkey(continued) ~ disarm `relation_dlg` `paramsphlay.partable`2 `rowregen_input` `name`;\
mapkey(continued) ~ select `relation_dlg` `paramsphlay.partable`2 `rowregen_input` `name`;\
mapkey(continued) ~ arm `relation_dlg` `paramsphlay.partable`2 `rowregen_input` `value`;\
mapkey(continued) ~ disarm `relation_dlg` `paramsphlay.partable`2 `rowregen_input` `value`;\
mapkey(continued) ~ select `relation_dlg` `paramsphlay.partable`2 `rowregen_input` `value`;\
mapkey(continued) ~ open `relation_dlg` `paramsphlay.partable_input`;\
mapkey(continued) ~ close `relation_dlg` `paramsphlay.partable_input`;\
mapkey(continued) ~ select `relation_dlg` `paramsphlay.partable_input`1 `yes`;\
mapkey(continued) ~ move `relation_dlg` `relation_dlg`2 29.984987 6.492077 ;\
mapkey(continued) ~ activate `relation_dlg` `pb_ok`;~ command `procmdregenpart` ;#read file;\
mapkey(continued) c:\temp\data.txt;~ command `procmdmmparams` ;\
mapkey(continued) ~ columnselect `relation_dlg` `paramsphlay.partable`1 `name`;\
mapkey(continued) ~ arm `relation_dlg` `paramsphlay.partable`2 `rowregen_input` `name`;\
mapkey(continued) ~ disarm `relation_dlg` `paramsphlay.partable`2 `rowregen_input` `name`;\
mapkey(continued) ~ select `relation_dlg` `paramsphlay.partable`2 `rowregen_input` `name`;\
mapkey(continued) ~ arm `relation_dlg` `paramsphlay.partable`2 `rowregen_input` `value`;\
mapkey(continued) ~ disarm `relation_dlg` `paramsphlay.partable`2 `rowregen_input` `value`;\
mapkey(continued) ~ select `relation_dlg` `paramsphlay.partable`2 `rowregen_input` `value`;\
mapkey(continued) ~ open `relation_dlg` `paramsphlay.partable_input`;\
mapkey(continued) ~ close `relation_dlg` `paramsphlay.partable_input`;\
mapkey(continued) ~ select `relation_dlg` `paramsphlay.partable_input`1 `no`;\
mapkey(continued) ~ move `relation_dlg` `relation_dlg`2 29.984987 6.492077 ;\
mapkey(continued) ~ activate `relation_dlg` `pb_ok`;~ command `procmdregenpart` ;

dove yyy é il nome della mapkey e c:\temp\data.txt é il file che verrá letto con i valori dei parametri.
se non userete la macro qui sotto, il file *.txt deve essere formattato cosí:
altezza = 500

6) potete quindi prendere un foglio excel inserire i valori come volete, l´importante é che in una pagina, per es. in "esporta", i dati siano formattati nella seguente maniera:
------colonna a---colonna b---colonna c
riga1-" altezza "------" = "-------" 500 "

7) inserire poi la seguente macro:

option explicit
public nametxt as string

sub export_txt()
dim x, y as integer
dim str, folder, name as string

x = 1
y = 1
sheets("porta").select

fold = "c:\ proe\"
name = "data.txt"

nametxt = folder & name

open nametxt for output as #1

do until cells(y, x).value = "
str = cells(y, x).value
for x = 2 to 3
str = str & " & cells(y, x).value
next

print #1, str
y = y + 1
== sync, corrected by elderman ==

loop



end

where of course folder and name can be to please, the important thing is that the name of the folder ends with "\".

8) at this point just connect the mapkey with a button.

When the data is changed on the excel sheet simply turn the macro and then mapkey and the game is done:)

I hope I was useful.

Hi.

france
 
Hello.

I never used this method to parameterize a part.
but do you get effects similar to family tables?
When should I use it?

thanks in advance for clarifications
 
Hello.

I never used this method to parameterize a part.
but do you get effects similar to family tables?
When should I use it?

thanks in advance for clarifications
the family table is something else, in fact it is used to generate different types of models starting from a standard.
Connecting an excel sheet with a template is useful if you need to update parameters quickly always of the same model.
In addition, if you have to manage many parameters of a complicated model, it is definitely easier to excel than by proe. In case you have some calculations to do, you should do them with excel and then export the results in proe.
if to export then are few results, there is also a faster method of connecting proes with excel so that proe automatically call the sheet, make the calculation and then take the solution in the model.
when I have 10 minutes then the place.

Hi.

france
 
Hi.
If there was an attachment it would certainly be clearer....... the purpose and method.

However it seems interesting......

bb
 
Hi.
If there was an attachment it would certainly be clearer....... the purpose and method.

However it seems interesting......

bb
here to you the Annex :)

Of course you have to read what I wrote on it so you can turn it around.
 

Attachments

Hello.

I never used this method to parameterize a part.
but do you get effects similar to family tables?
When should I use it?

thanks in advance for clarifications
in practice if I have different parameters to load in one part I can do them quietly by xls, and it seems interesting to me......

I really understood little. Has anyone tried? ?

Thank you.

bb
 
I tried what was indicated by arimans and thanks to the test.zip files I managed to make it work. Great, congratulations to arimans.
Now I turn to arimans or to whom I know how to make clarifications.
My final goal would be to find a way to make a mass import of parameters values that I defined in a sheet of excel that maybe I got into with queries and more... (for example: set in all parts of the axieme or + simply component x component, certain paramentaries driven by excel cells, the last cost of production loaded etc...).
I would like to try to study this procedure thanks to the subject of arimans but I realize that I lack several elements:
- regen_input what is it? is a proe configuration parameter, if you how it works? I tried to find him on the online guide but nothing.
I can't understand the steps you've done in the macro, it looks like you've uploaded values from the relationships menu, you could explain better.
Thank you.
 
Bye to all,
this post is very interesting, it made me reflect for its possible application.
I agree with Moorish; Is there someone who knows how it was built is macro? ?
What is it?

Thank you.
 
Hello arimans,
I tried to connect the example you attached, but when I start the macro from excel it generates an error because it does not find the einglab.txt file that I copied directly in c:

It's weird! !
Can you help me? ?

Thank you.
bb
 
Hi, I have a problem in understanding how to make the macro with pro and.
after going on record that buttons I have to press to connect to the sheet in txt?? ?

 

Forum statistics

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

Members online

No members online now.
Back
Top