LDraw.org Discussion Forums
Part annotation in LPub3D - Printable Version

+- LDraw.org Discussion Forums (https://forums.ldraw.org)
+-- Forum: LDraw Programs (https://forums.ldraw.org/forum-7.html)
+--- Forum: LDraw Editors and Viewers (https://forums.ldraw.org/forum-11.html)
+--- Thread: Part annotation in LPub3D (/thread-17401.html)



Part annotation in LPub3D - Jaco van der Molen - 2015-09-29

Hi all,

Through regular expressions the part annotation can be extracted from the part description.
I'd like the annotation for Technic Bricks to be only the length (like beams).
The regex now is ^Technic Brick\s+(\d+\s+(x|X)\s+\d+\s*(x*|X*)\s*\d*\.*\d*)\s*.*$
This extracts the full size of the brick, ie. Technice Brick 1 x 16 gives "1 x 16".
What I'd like is only the 16.
How do I do that?

Thanks.


Re: Part annotation in LPub3D - David Manley - 2015-09-29

Try:

Technic: ^Technic Brick\s+\d+\s+[xX]\s+(\d+\s*(x*|X*)\s*\d*\.*\d*)\s*.*$


Regards,

David


Re: Part annotation in LPub3D - Jaco van der Molen - 2015-09-30

Thanks so much David! That works :-)


Re: Part annotation in LPub3D - Jaco van der Molen - 2015-10-08

This all works great! Love LPub3D.
Another question regarding part annotation:

With above expression I show only the length of technic bricks.
Great if you have a model with a step that has say a 16 and 14 studs brick.
It is easier to identify longer bricks that way.
But hereĀ“s the thing: using the expression all lengths of all technic bricks are shown.
What if I want to exclude some? Say Technic Brick 1 x 2 with Axlehole. There is no need showing it is 2 studs in length or for a 1 x 2 brick for that matter.
Is there a way to do this, besides hand coding all bricks using only Freeform annotation?

Any thoughts?


Re: Part annotation in LPub3D - David Manley - 2015-10-11

Not unreasonably, it looks like it will stop after it has found the first matching regular expression.

So for example, if you add the definition:

Technic: ^Technic Brick\s+\d+\s+.*with Axle.*$

before the definition

Technic: ^Technic Brick\s+\d+\s+[xX]\s+(\d+\s*(x*|X*)\s*\d*\.*\d*)\s*.*$

The Technic Brick with axlehole is not augmented with the length while the other Technic bricks are.

I think the key to what it output is whatever is within the (first?) set of parenthesis. Hence, as the first definition has no parenthesis, it outputs nothing as the annotation title.

I'd imagine that an appropriate definition could be created for small length Technic bricks to not output their length in the annotation.

Regards,

David


Re: Part annotation in LPub3D - Jaco van der Molen - 2015-10-12

OK, sounds logic. I'll try it.


Re: Part annotation in LPub3D - Jaco van der Molen - 2016-01-13

David Manley Wrote:Try:
Technic: ^Technic Brick\s+\d+\s+[xX]\s+(\d+\s*(x*|X*)\s*\d*\.*\d*)\s*.*$
Regards,
David
This does not seem to work anymore?


Re: Part annotation in LPub3D - Trevor Sandy - 2016-01-22

This bug is now fixed in the latest release LPub2D 1.3.2.

Cheers,


Re: Part annotation in LPub3D - Jaco van der Molen - 2016-01-22

Trevor Sandy Wrote:This bug is now fixed in the latest release LPub2D 1.3.2.
Great! Thanks so much!