LDraw.org Discussion Forums

Full Version: Part annotation in LPub3D
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
Try:

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


Regards,

David
Thanks so much David! That works :-)
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?
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
OK, sounds logic. I'll try it.
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?
This bug is now fixed in the latest release LPub2D 1.3.2.

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