суббота, 18 августа 2018 г.

Implant text (pml, c#) part 1

Sometimes to implement in PDMS/E3D some useful functions C# language comes to help.
Examples you can found in the folder "Samples" with the program.
I want to make a function that would insert text into another text in the required position and return new line. And use it in PML. Go!

1. Run Visual Studio and make a project with name NetHelper.

2. Add reference to PMLNet.dll. It exists in program folder.

3. Change your class like that (link).

4. Add new class "StringExtension" and change it (link)

5. Build solution.


How to use the solution see next post.

How to calculate bend radius? (PML)

It happens that it is necessary to check what the bending radius is equal to.
In the part attributes, this property is missing.
The PML comes to the rescue. To do this, we write the function.

    define function !!bendradius(!bend is dbref) is real
        !line = object line(!bend.ppos[1], !bend.ppos[2])
        !lengthLine = !line.Length().ConvertUnits('mm')
        !angle = 180 - !bend.pdir[1].angle(!bend.pdir[2]).ConvertUnits('degree').Value()
        !sin = sin ( !angle / 2 )
        !raduis = !lengthLine / ( 2 * !sin )
        return !raduis

How to find the radius?

All sources storage


This is my blog about programming, in particular for Aveva PDMS/E3D, automation of engineering work, etc.
Now my Eglish is pre-intermediate. And I set the goal for the year to reach my level to Upper-Intermediate and  improve my speak skills too.
Leave your comments, wishes and feedback under publications.