Flip Line Command

Forum for the PDF-XChange Editor - Free and Licensed Versions

Moderators: Daniel - PDF-XChange, PDF-XChange Support, Vasyl - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

KD952
User
Posts: 109
Joined: Mon Feb 13, 2023 6:13 am

Flip Line Command

Post by KD952 »

Hello!

In earlier Versions (Version: 8.0, build 338.0) the flip Line Command could be used to flip the direction of the text-box in the distance tool.
image.png

In newer Versions this no longer works. (Version: 10.1.1, build 381)

Is there a way to get the same result? Or could we bring this feature back?

Technical drawings are read from the right but the direction of the text box is dependent on the way you place the distance annotation.
Is there a way to force right facing text? For example PDF-XChange Editor never places the text upsite down regardless of the way you place the distance annotation.

Kind regards,
Daniel
You do not have the required permissions to view the files attached to this post.
Willy Van Nuffel
User
Posts: 2742
Joined: Wed Jan 18, 2006 12:10 pm

Re: Flip Line Command

Post by Willy Van Nuffel »

It seems like you will have to use the "Rotate 180°"-feature instead of "Flip Line".

This feature is available via Arrange in the contextual menu, while the distance-object is selected OR via the Measuring Tools / Arrange ribbon (also while the distance-object is selected).

See:
- viewtopic.php?t=36561

Kind regards and keep us posted.
KD952
User
Posts: 109
Joined: Mon Feb 13, 2023 6:13 am

Re: Flip Line Command

Post by KD952 »

Thank you Willy Van Nuffel!

I just read your linked post.

I set a shortcut for "Rotate 180°". Works well enough. Just a litte bit worse then the original "Flip Line". :D

Kind regards
Daniel

P.S. Maybe the idea of forcing right facing text could be considered by the devs?
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19846
Joined: Mon Jan 12, 2009 8:07 am

Re: Flip Line Command

Post by Stefan - PDF-XChange »

Hello KD952,

Depending on the position of the measurement, and the angle it is at - an "automatic" force of one setting over another might be the worse choice. That's why the default is one, and if necessary you can rotate the line 180 degrees to get the desired result.

Kind regards,
Stefan
Willy Van Nuffel
User
Posts: 2742
Joined: Wed Jan 18, 2006 12:10 pm

Re: Flip Line Command

Post by Willy Van Nuffel »

Maybe something that might help (and maybe this is "by design / out-of-the-box") ...

When you press the SHIFT-key while drawing a distance line, you can rotate that line in angels of x-times 15°

Now, when you do this while drawing a vertical distance line from the bottom to the top, the text will be right oriented.

When you do the same, but drawing the distance line from the top to the bottom, the text is left oriented.

Is that something useful ?
KD952
User
Posts: 109
Joined: Mon Feb 13, 2023 6:13 am

Re: Flip Line Command

Post by KD952 »

Thank you Willy Van Nuffel. Yes I know, but this is really not something I want to think about when drawing. "Rotate 180°" works fine, its just a littel bit slower because you have to reajust the position of the annotation.

@Stefan I did not suggest that options should be taken away from the user. Maybe just a litte small dropdown menu in the distance tool properties could be added. :wink:
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19846
Joined: Mon Jan 12, 2009 8:07 am

Re: Flip Line Command

Post by Stefan - PDF-XChange »

Hello KD952,

I think there was a technical reason why "Flip Line" stopped working for the text value. I will check with our devs on whether they are considering any improvements to the measurements tools that would make your life easier and post an update here if they do have any such plans!

Kind regards,
Stefan
Mathew
User
Posts: 567
Joined: Thu Jun 19, 2014 7:30 pm

Re: Flip Line Command

Post by Mathew »

I agree it would be nice if the flip line tool just did this. It is very easy to do with javascript. Here's a small script I use that adds a button to add-on tools. It flips the direction of text of all selected dimension lines, without moving the dimension lines.

Save it as a text file with suffix .js in the Javascripts folder to have it load to the toolbar when you start the application:

Code: Select all

// Script to flip the text on dimensions
var myIcon = {count:0, width:20, height:20, read:function(nBytes=this.data.length/2){return this.data.slice(this.count,this.count+=2*nBytes)}, data:"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFF9AC94000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFF704380FE937180FF9372FFFF70430000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080FF9372FFFF7043FFFF704380FF93720000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080FF9372FFFF7043FFFF704380FF937200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080F7C1B0FFFF704380FF937280FF9372FFFF704380F7BEAC00000000000000000000000000000000000000000000000000000000000000000000000000000000BF00000000000000000000006CF7C9BAFFFE744980F7BEAC000000000000000080F7BEACFFFF704380F7BEAC00000000000000000000000000000000BF000000000000000000000000000000BF00000000000000000000006CF7C9BAFFFE744965F7C9BB00000000000000000000000041F6D2C680F7BEACFFFF7043000000000000000000000000BF000000000000000000000000000000BF00000000000000000000006CF7C9BAFFFE744965F7C9BB00000000000000000000000000000000000000000000000080F7BEAC0000000000000000BF00000000000000BF000000000000000000000000000000000000006CF7C9BAFFFE744965F7C9BB00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000BF00000000000000000000006CF7C9BAFFFE744965F7C9BB0000000000000000000000000000000080B7D39AFF9CC472000000000000000000000000000000000000000000000000000000000000000000000000000000006CF7C9BAFFFE744965F7C9BB00000000000000000000000041D5E3C6FF8DBC5CFF7CB342FF7CB34280C6DBB000000000000000000000000000000000000000000000000000000000000000006CF7C9BAFFFE744965F7C9BB00000000000000000000000080A8CA83FF7CB342FF7CB342FF7CB342FF7CB342FF84B74F000000000000000000000000000000000000000000000000000000006CF7C9BAFFFE744965F7C9BB00000000000000000000000080C3D9ABFF9DC574FF83B64CFF7CB342FF7CB342FF7CB342FF7CB34280A8CB84000000000000000000000000000000000000000080F7C9BAFFFE744965F7C9BB0000000000000000000000000000000000000000000000000FD7E4CAFF7CB342FF7CB342FF81B549FF8BBB59FF7CB34241D5E3C600000000FF42A5F58071BBF78071BBF7FF42A5F57FE2C4C10000000000000000000000000000000000000000000000000000000080B3D194FF7CB342FF7CB34280A9CB85000000000000000000000000000000008071BBF7FF42A5F5FF42A5F58071BBF70000000000000000000000000000000000000000000000000000000000000000FF84B74FFF7CB342FF7CB34300000000000000000000000000000000000000008071BBF7FF42A5F5FF42A5F58071BBF70000000000000000000000000000000000000000000000000000000080B3D093FF7CB342FF7CB34280B7D3990000000000000000000000000000000000000000FF42A5F58071BBF78071BBF7FF42A5F58096CAF400000000000000000000000000000000000000008CD1E1C0FF7CB342FF7CB34280A2C77B0000000000000000000000000000000000000000FF71BBF700000000000000000000000072B9D9F4FF42A5F572B9D9F400000000000000000000000080C2D9AAFF7EB445FF83B74D80C1D8A8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000072B9D9F4FF42A5F5000000000000000080BBD59F80B4D19541D5E3C60000000000000000000000000000000000000000000000000000000000000000"};
// This adds a button to the Add-on Tools toolbar
app.addToolButton( {
	cName: "flipDimText",
	//cLabel: "Flip Dim Text", // remove the double slash (comment) to add a text label
	oIcon: myIcon,
	cTooltext: "Flip dimension line text.",
	cEnable: "event.rc = (this.selectedAnnots && this.selectedAnnots.length)",
	cExec: "flipDimText(this)" }
);

function flipDimText(t) {
for (let a of t.selectedAnnots) {
	if ("LineDimension" == a.intent ){
		// flip the ends of dimension to change direction
		// negative leader length to keep in same location
		let revs = {
			"points": [a.points[1],a.points[0]],
			"leaderLength": -a.leaderLength,
			};
		a.setProps( revs );
	}
}
}
KD952
User
Posts: 109
Joined: Mon Feb 13, 2023 6:13 am

Re: Flip Line Command

Post by KD952 »

Thank you very much Mathew!
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19846
Joined: Mon Jan 12, 2009 8:07 am

Flip Line Command

Post by Stefan - PDF-XChange »

:)
Mathew
User
Posts: 567
Joined: Thu Jun 19, 2014 7:30 pm

Re: Flip Line Command

Post by Mathew »

:)
Here it is as a file, with a slightly different icon.
flip Dim text v0.2.zip
You do not have the required permissions to view the files attached to this post.
KD952
User
Posts: 109
Joined: Mon Feb 13, 2023 6:13 am

Re: Flip Line Command

Post by KD952 »

Hello Mathew!

Thank you again.
Is the original image for the icon realy 20x20 pixels?
Looks very intricate.
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19846
Joined: Mon Jan 12, 2009 8:07 am

Re: Flip Line Command

Post by Stefan - PDF-XChange »

Hello KD952,

As Mathew has coded the icon inside the JS code directly - he has likely deliberately kept it small.
If you remove the part where he specified the Icon from his code - you will get a bigger jigsaw puzzle generic icon like this:
image.png
Kind regards,
Stefan
You do not have the required permissions to view the files attached to this post.
Mathew
User
Posts: 567
Joined: Thu Jun 19, 2014 7:30 pm

Re: Flip Line Command

Post by Mathew »

Yes, I've been keeping icon sizes to 20x20 because in the Acrobat JS API it says
The icon size is restricted to 20 by 20 pixels. If an icon of larger dimensions is used, an exception is thrown.
I don't know if there's a restriction in PDF-XChange, or what it is.

I've attached the pdf I use to encode icons and save it directly in the javascript file.
Get Icon Stream.pdf
I find it's just easier to encode in the javascript than having a separate file, but PDF-XChange came up with a custom method that encodes a png to an icon directly. viewtopic.php?p=112037#p112037
You do not have the required permissions to view the files attached to this post.
Last edited by Mathew on Wed Nov 08, 2023 7:41 pm, edited 1 time in total.
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 10998
Joined: Wed Jan 03, 2018 6:52 pm

Re: Flip Line Command

Post by Daniel - PDF-XChange »

Hello, Mathew

We do stick pretty closely to the rules defined by the API (to be honest, most places where we do not, are likely oversights, and will probably be fixed to follow it more closely in the future).

Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com