Code snippets

Info about design forms features
PetrS
Site Admin
Posts: 181
Joined: 11 Jul 2014, 13:55

Code snippets

Postby PetrS » 24 Nov 2014, 15:24

size=150Code snippets/size
Version 0.1.96+


'Code snippets' are short, predefined parts of the often used parts of the code.

buUsing code snippets:/u/b
1) Place cursor at the place where you want to insert code.
2) Click right mouse button in the code editor
3) Select appropriate snippet from the Context menu.


buPredefined templates:/u/b
When you are creating new calculation, you can select empty file (standard) or predefined template.
1) Go to Main menu - File
2) Hoover mouse over item 'New'
3) Select required template from the sub-menu


If you need to add any code snippet / template, just post a request here.
Ing. Petr Slepicka
DesignForms Online
Engineering calculations online - EuroCode, AISC, statics
Automate your static calculations today!

PetrS
Site Admin
Posts: 181
Joined: 11 Jul 2014, 13:55

Re: Code snippets

Postby PetrS » 19 Feb 2015, 09:52

size=150Custom code snippets/size
Version R15+

You can define your own code snippets, which are available in CodeEditor - Context menu - Code snippets.
Custom code snippets are saved in file ic:\Users\<UserName>\Documents\DesignForms_<VersionNumber>\CodeSnippets.xml/i

buFile sample:/u/b
code
<Root>
<Code Text="IF-ELSE">
IF () {
} ELSE {
}
</Code>
<Dir Text="Folder 1">
<Code Text="SWITCH - CASE">
SWITCH(Expression) {
CASE 0: { }
CASE 1: { }
DEFAULT: { }
}
</Code>
<Code Text="FOR">
FOR(i, 0, 0) {
}
</Code>
</Dir>
<Dir Text="Folder 2">
<Code Text="IO.IsDrawing -> Table">
IF (IO.IsDrawing) {
object T = new Table( );
T.Draw;
}
</Code>
<Code Text="Compare">
COMPARE(First, Second, 6);
</Code>
<Code Text="LoadExternCLC">
object Extern = LoadExternCLC("RelPath.CLC");
</Code>
</Dir>
</Root>
/code

As you can see, file format is simple XML. It is composed from <Dir> and <Code> nodes.
list
*i<Root> ... </Root>/i - obligatory part (root element)/*:m
*i<Dir Text="FolderDescription"> ... </Dir>/i - Folder (sub menu) definition. <Dir> nodes define structure of the context menu & submenus. <Dir> node can be nested inside another <Dir> node. Text attribute is obligatory./*:m
*i<Code Text="SnippetDescription"> ... </Code> /i- Definition of code snippet. <Code> node can be nested inside <Dir> or it can be placed directly at <Root> level. Text attribute is obligatory./*:m/list:u

bUpdate:/b
from version 13.400.162 (Deve_SDF_main), not yet merged to R
doxygen documentation of functions is possible, therefore code snippets were updated with one and two level list for this documentation.
For details about function documentation by doxygen see url=http://designforms.net/forum/viewtopic.php?f=2&t=2253another post/url.
Attachments
CodeSnippets.xml
Updated code snippets with one and two level list for code documentation
(1.36 KiB) Downloaded 391 times
Ing. Petr Slepicka
DesignForms Online
Engineering calculations online - EuroCode, AISC, statics
Automate your static calculations today!


Return to “Design forms features”

Who is online

Users browsing this forum: No registered users and 5 guests