so42017
@ Trimble.
{All Unit Conversions from a TextBox werk EXCEPT this one! - API- Ganeral ciscussions - Takla Discussion Farum
Teka Ontine
We are evolving, Trimble Identity is your account to many Trimble online services. Use your Trimble Identity now also to sign in
to Tekla Online services.
Teklao
sion Forum —+ Tekla Structures Developer Foruins + API- General discussions
All Unit Conversions from a TextBox work EXCEPT this one!
Started by Trevor Gronseth, Nov 03 2015 10:27 PM
‘Trevor Gronseth
Building a plugin and want to be able to enter units in the text field the way Tekla allows
you to do it.
With Imperial Units:
48,5. - Works
48,5" - Works
/2.- Works
4.04167" - Works
405 - DOESNT WORK! (But the text fields in Tekla allow you to do this).
Here's the relevant code:
Distance Inches = new Distance(s
Inches = Distance. Parse(textBoxt. Text, CultureInfo.TnvartantCulture, Distance.UnitType.tneh);
Polygons. Points. Adé(new TSG3D.Potnt(rpI.X, rpI.Y, Max? + Inches.Value)); //Port of @ rebor polygon
One last thing...'m testing this code as an Application (Windows Form) but will eventually
want to make this a Plugiin...are there any nasty formatting surprises that still need to be
dealt with, or willbe fine if make my flelds as type "string"?
Eric W. Torola
Do a search on the imperial formatting, this has been discussed before.
For plugins, if you set the Tekla Structures Attributes to Distance and Text, it will be all done
for you, you won't need to do the conversion yourself as you show in your post. Actually |
do this in Applications also out of laziness.
(https://forum.tekia.com/uploads/monthly 11_2015/post-$4202-0-
89022000-1446598843, png)
‘Trevor Gronseth
bps:tforum tkla com/index ohp?%2Fopic%2F 14186ll-nt-conversions-from-atoxtbox-work-xcopt. is one%2F%3FN=toxtbox 6ro4reor7 [Al Urit Conversions frm a TextBox work EXCEPT this one! - API- General discussion - Tela Discussion Forum
I did notice the "Tekla Structures" Portion of the Property Box within the PluginForm but did
not see it in the Windows Form Application Form.
How do you create the Windows Form so those properties show up? Sornething to do with
Tekia Structures. Dialog...but now sure what,
fm new to all this and am still in the “reverse engineering" phase of my learning...50 | may
be missing something obvious.
Calor FoRel ONTOS SOTA
Hello,
Plugin forms should inherit PluginFormBase but forms for applications should inherit from
ApplicationFormBase,
Regards,
ec W.Torola Tod caver TE. OTSA
On the right side of Visual Studio, click on the Toolbox tab (vertical tab). Click on the thumb
tack on the top to pin it open.
(https://forum.tekla.com/uploads/monthly_11_2015/post-4202-0-71577300-
1446643822.png)
‘Then in Windows Explorer go to C:\Program Files\Tekla Structures\19.0\nt\bin\plugins
(nttps//C)
Drag the Tekla.Structures.Dialog.dl to the bottom of the Toolbox under the General group.
(https://forum.tekia.com/uploads/monthly 11_2015/post-$4202-0-
39570200-1446643918,png)
‘Then you can drag the StructuresExtender control to your form. it will add it as shown.
= (https://forum.tekla.com/uploads/monthly_11_2015/post-$4202-0-
03647500-1446644018.png)
Then you will have these properties in your Application
‘Trevor Gronseth
Eric,
ve done what you suggested but am still stuck... even applied my 60+ minute rule (that is,
‘won't ask for more help until Ive tried to figure it out- and scour similar posts - for at least
60 minutes).
bps:tforum tkla com/index ohp?%2Fopic%2F 14186ll-nt-conversions-from-atoxtbox-work-xcopt. is one%2F%3FN=toxtboxso42017
{All Unit Conversions from a TextBox werk EXCEPT this one! - API- Ganeral ciscussions - Takla Discussion Farum
I can't figure out the code to call up that attribute field, even though I've defined it as
"Distance" and "Text" like you sald, And I'm not sure what you meant by lazy since my
original code was only 2 lines!
‘That means, the NEW code must be (at the max) 1 line to convert that textbox value into 2
double.
Erie W. Torola
Laziness is relative, some of us are more lazy then others. @
Ifyou only have one textbox OK, but if you have like some of my apps, 100s, then not only
will you save time, but eliminate possible places for bugs.
Try this to get the value
double snches
cetattrsbutevaluecdovble>(taxtboxd) /25.43
| always work in mm in my plugins/applications so | don't have to convert back and forth so
much.
Trevor Gronseth
Makes sense...except, for some reason "Get
there a certain namespace I'm not declaring?
is not available in my scope..is
Eric W. Torola
Ifyou created your project using the Tekla application Template (recommended) it would be
there. I don't think it is in a using namespace but in the Form base classes Tekla supplies in
the API
For an Application your Form should use the ApplicationFormBase as a base class,
public partial class MainForn : Applicationfornaase
but if you should also check that at least these are defined
‘sing Teka. structures:
Using Telda. structures. osalog
‘using Tella structures. oatatype;
‘Trevor Gronseth
‘Thanks again...my fault for being a bull-n-the-china-shop and not reading the StartUp docs
well enough.
Eric W. Torola
bps:tforum tkla com/index ohp?%2Fopic%2F 14186ll-nt-conversions-from-atoxtbox-work-xcopt. is one%2F%3FN=toxtboxso42017
{All Unit Conversions from a TextBox werk EXCEPT this one! - API- Ganeral ciscussions - Takla Discussion Farum
No problem. | often forget about the startup docs myself when looking for stuff.
‘Trevor Gronseth
(Ok, back at it
Even with the Model Plugin Template, | still can’t call up GetAttributeValue.
‘The Plugin Template has a lot of new code that I'm not comfortable with, so tinkering is not
easy.
If search the Reference Browser, it does locate it within
Tekla Structures.Dialog.FormBase...but it appears it's protected (sill don't know what
means).
Imust have to include special code to get access to it72? See my attached pic.
Attached Thumbnails
— (https://forum.tekla.com/uploads/monthly_11_2015/post-54608-0-
61653800-1446677927. png)
Eric W. Torola
FoR 5 Novena 2515 -SN
| did the following using VS2015 and Tekla 21.0 which it looks ike what you are using.
41) Create a new VS Project using the Tekla Model Plugin template
2) Add a TextBox to the form
3) Create an Attribute for the TextBox
(https://forum.tekla.com/uploads/monthly_11_2015/post-54202-0-
15606300-1446687760.png)
4) Add a button
5) Create a click event for the button by double clicking on it
6) Add a line of code to the botton click event
private votd buttoni_CLick(obect sender, EventArgs e)
‘
‘this. Getattributevatuecdovble(textBoxt);
:
I didn't do anything else, add any references, add any toolbox items, add any using
statements or Base Form classes
‘Trevor Gronseth
‘Thanks, Eric.
bps:tforum tkla com/index ohp?%2Fopic%2F 14186ll-nt-conversions-from-atoxtbox-work-xcopt. is one%2F%3FN=toxtboxso42017
{All Unit Conversions from a TextBox werk EXCEPT this one! - API- Ganeral ciscussions - Takla Discussion Farum
Itworks just fine. I'l track you down at the user conference and buy you a beer.
Eric W. Torola
Sounds good Trevor, see you there
Trevor Gronseth
Ok... maybe just a coke... @
My original question was about auto-formatting feet with decimal inches...4°0.5
Even with all the help, the plugin form rejects that value...that is, if| enter that value in the
fleld, the form won't even let me hit cancel or close, it just hangs there until enter in a
recognized formatted distance.
Digging around a bit..for some reason, the Ship Ladder plugin lets you do it, but the
Strand Pattern plugin hangs up just ike mine...5o whoever wrote these made them
differently. There's some setting sormewherell!! What is it27?
‘Trevor Gronseth
Further Digging,
It looks lke the only Model Plugin Example from the Start Up API
distance format types (4'2.5 or Addition) is the SplicePlugin.
iat accepts all the
However..this one doesn’t use a Plugin-Form...it uses a.Inp form!
Is that the difference? Sucks if itis since .inp formatting sucks.
Eric W. Torola
Do a search on the imperial formatting this has been discussed before,
Did you do this?
‘Trevor Gronseth
Absolutely...| would feel ashamed bothering experienced professionals without attempting
to solve the issue/research it first.
This Post was the closest | could find and concluded with Carlos saying that the PluginForm
doesn't have the same logic as the Internal Tekla Forms...
bps:tforum tkla com/index ohp?%2Fopic%2F 14186ll-nt-conversions-from-atoxtbox-work-xcopt. is one%2F%3FN=toxtboxso42017 {All Unit Conversions from a TextBox werk EXCEPT this one! - API- Ganeral ciscussions - Takla Discussion Farum
https://forum.tekdla....in/?h|=imperial
(nttps://forum.tekla.com/index.php?/topic/13589-behavior-of-distance-control-in-
imperial-environment-plug-in/?hI=imperial)
Eric W. Torola Foss November 15109
‘As far as | know the functionality has not changed. | think there was a post or two in the
distant past (old extranet) where someone posted how they did it manually
Back to API- General discussions - Next Unread Topic +
Tekla disc
‘uclures Developer Forums + API- General discussions
elt a Ted a Download: Report piracy
hla BIMsigh I Warehou
la Feld30 a Cary
. Tekta Chil
f
Tekla servi Trimble websit
bps:tforum tkla com/index ohp?%2Fopic%2F 14186ll-nt-conversions-from-atoxtbox-work-xcopt. is one%2F%3FN=toxtbox 6