Question:
Is there any way to edit the location of a point by just typing in the coordinates I want?
Say, I want a line from (1,1) to (10.5, 11.125) exactly. Is there any dialog I can use to select the points on the line and set their coordinates exactly where I want them?
I'm not looking for snap guides which I'd have to reset between editing every point. I'm not looking to move the entire shape form the position and size menu. Just a single point within the shape.
Is this possible? It seems like it should be the most basic of basic functionality. When you select a point, it displays the coordinates in the lower status bar. But I can't find a way to edit them.
Entering the coordinates of points explicitly?
Entering the coordinates of points explicitly?
OpenOffice 4.0.0 with Windows 7
Re: Entering the coordinates of points explicitly?
Unless I'm misunderstanding your question, can you not right click on the line and select 'Position and size...' ?
Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.8.3.2; SlackBuild for 24.8.3 by Eric Hameleers
---------------------
Apache OpenOffice 4.1.15
LibreOffice 24.8.3.2; SlackBuild for 24.8.3 by Eric Hameleers
---------------------
Roses are Red, Violets are Blue
Unexpected '{' on line 32
.Re: Entering the coordinates of points explicitly?
I'm trying to set the location of a point, as in a single vertex, not the entire line. Position and size only allows the entire shape to be moved.robleyd wrote:Unless I'm misunderstanding your question, can you not right click on the line and select 'Position and size...' ?
OpenOffice 4.0.0 with Windows 7
Re: Entering the coordinates of points explicitly?
Aahh, I get it Can't help, sorry
Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.8.3.2; SlackBuild for 24.8.3 by Eric Hameleers
---------------------
Apache OpenOffice 4.1.15
LibreOffice 24.8.3.2; SlackBuild for 24.8.3 by Eric Hameleers
---------------------
Roses are Red, Violets are Blue
Unexpected '{' on line 32
.Re: Entering the coordinates of points explicitly?
Workaround: Right click in your drawing and insert snap points. Draw lines between the snap points.
To make it workable, you may need to disable grid snap, and enable guide-line/-point snap:
To make it workable, you may need to disable grid snap, and enable guide-line/-point snap:
- Select menu item Tools - Options
- Expand/select branch Draw - Grid
- Untick Snap to grid in the Grid section.
- Tick To snap lines in the Snap section.
- Adjust snap range for a comfortable drawing experience.
Apache OO 4.1.12 and LibreOffice 7.5, mostly on Ms Windows 10
Re: Entering the coordinates of points explicitly?
You can write a macro for this task based on the API functions...Say, I want a line from (1,1) to (10.5, 11.125) exactly. Is there any dialog I can use to select the points on the line and set their coordinates exactly where I want them?
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Re: Entering the coordinates of points explicitly?
Here is a not perfect example for adjusting the points of a selected polygon or a simple line.
(Use the icons of the custom toolbar named 'New Toolbar1' of the atached .odg document.) (I have used some bult-in icons for the associated to the subroutines on the Custom toolbar. These icons are used for another functions too in the AOO/LO.)
You can adjust the StartPoint, or the EndPoint or all of the points of a selected Polygons by usage of my macros.
There are three pages in my example file:
The first page contains some basic polygon shapes.
The second page shows the difference between the Startpoint and the Endpoint of a used Line-Array combo. (The StartPoint an EndPoint are not determined by the kind of the shape of the array. The conventional StartPoint and EndPoint property of a line is not depend on the type of the shape located at the beginning or at the end of the line. Maybe a Dot is the "EndPont" maybe an Arrow is the "EndPoint".)
The third page contains some non-Polygon type objects. But you can convert these objects to Polygon by a built-in feature, attached to the Custom toolbar. (It is available from the menu, too.) Then you will able modify the coordinates of their points - when this method is appropriate for you.
The helper functions for the determination of the selected objects was created by Danny Brewer. I just modified them - when it was necessary.
(Use the icons of the custom toolbar named 'New Toolbar1' of the atached .odg document.) (I have used some bult-in icons for the associated to the subroutines on the Custom toolbar. These icons are used for another functions too in the AOO/LO.)
You can adjust the StartPoint, or the EndPoint or all of the points of a selected Polygons by usage of my macros.
There are three pages in my example file:
The first page contains some basic polygon shapes.
The second page shows the difference between the Startpoint and the Endpoint of a used Line-Array combo. (The StartPoint an EndPoint are not determined by the kind of the shape of the array. The conventional StartPoint and EndPoint property of a line is not depend on the type of the shape located at the beginning or at the end of the line. Maybe a Dot is the "EndPont" maybe an Arrow is the "EndPoint".)
The third page contains some non-Polygon type objects. But you can convert these objects to Polygon by a built-in feature, attached to the Custom toolbar. (It is available from the menu, too.) Then you will able modify the coordinates of their points - when this method is appropriate for you.
The helper functions for the determination of the selected objects was created by Danny Brewer. I just modified them - when it was necessary.
Last edited by Zizi64 on Sun Dec 18, 2016 10:25 am, edited 2 times in total.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Re: Entering the coordinates of points explicitly?
The macro code that is located in the attached .odg document:
Code: Select all
REM ***** BASIC *****
Option Explicit
Sub EditStartPoint
Dim oDoc As Object
Dim PolyPolygonShape As Object
Dim StartPoint As New com.sun.star.awt.Point
Dim Margin as Long
Dim Value as Long
Dim PointsNumber as integer
Dim i as Integer
Dim InputStr as String
oDoc = ThisComponent
If IsNull(oDoc) Then
Exit Sub
EndIf
PolyPolygonShape = MyGetCurrentlySelectedSingleShape(oDoc, False)
If IsNull(PolyPolygonShape) then
exit sub
End if
PointsNumber = UBound(PolyPolygonShape.PolyPolygon(0))
Dim Points(PointsNumber) As New com.sun.star.awt.Point
Array(Points()) = PolyPolygonShape.PolyPolygon
Margin = oDoc.getDrawPages().getByIndex(0).BorderLeft
InputStr = ""
Value = PolyPolygonShape.PolyPolygon(0)(0).x - Margin
InputStr = InputBox ("StartPoint X coordinate [mm]", "Please type in:", format(Value/100,"0.##"), 3000, 2000)
If InputStr<>"" then Value = int(100*CDbl(InputStr))
Points(0).x = Value + Margin
Margin = oDoc.getDrawPages().getByIndex(0).BorderTop
InputStr = ""
Value = PolyPolygonShape.PolyPolygon(0)(0).y - Margin
InputStr = InputBox ("StartPoint Y coordinate [mm]", "Please type in:", format(Value/100,"0.##"), 3000, 2000)
If InputStr<>"" then Value = int(100*CDbl(InputStr))
Points(0).y = Value + Margin
For i= 1 to PointsNumber
Points(i).x = PolyPolygonShape.PolyPolygon(0)(i).x
Points(i).y = PolyPolygonShape.PolyPolygon(0)(i).y
next i
PolyPolygonShape.PolyPolygon = Array(Points())
End sub
'___________________________________________________________________________________________________________________
Sub EditEndPoint
Dim oDoc As Object
Dim PolyPolygonShape As Object
Dim EndPoint As New com.sun.star.awt.Point
Dim Margin as Long
Dim Value as Long
Dim PointsNumber as integer
Dim i as Integer
Dim InputStr as String
oDoc = ThisComponent
If IsNull(oDoc) Then
Exit Sub
EndIf
PolyPolygonShape = MyGetCurrentlySelectedSingleShape(oDoc, False)
If IsNull(PolyPolygonShape) then
exit sub
End if
PointsNumber = UBound(PolyPolygonShape.PolyPolygon(0))
Dim Points(PointsNumber) As New com.sun.star.awt.Point
Array(Points()) = PolyPolygonShape.PolyPolygon
For i= 0 to PointsNumber-1
Points(i).x = PolyPolygonShape.PolyPolygon(0)(i).x
Points(i).y = PolyPolygonShape.PolyPolygon(0)(i).y
next i
Margin = oDoc.getDrawPages().getByIndex(0).BorderLeft
InputStr = ""
Value = PolyPolygonShape.PolyPolygon(0)(PointsNumber).x - Margin
InputStr = InputBox ("EndPoint X coordinate [mm]", "Please type in:", format(Value/100,"0.##"), 3000, 2000)
If InputStr<>"" then Value = int(100*CDbl(InputStr))
Points(PointsNumber).x = Value + Margin
Margin = oDoc.getDrawPages().getByIndex(0).BorderTop
InputStr = ""
Value = PolyPolygonShape.PolyPolygon(0)(PointsNumber).y - Margin
InputStr = InputBox ("EndPoint Y coordinate [mm]", "Please type in:", format(Value/100,"0.##"), 3000, 2000)
If InputStr<>"" then Value = int(100*CDbl(InputStr))
Points(PointsNumber).y = Value + Margin
PolyPolygonShape.PolyPolygon = Array(Points())
End sub
'___________________________________________________________________________________________________________________
Sub EditAllPoints
Dim oDoc As Object
Dim PolyPolygonShape As Object
Dim StartPoint As New com.sun.star.awt.Point
Dim Margin as Long
Dim Value as Long
Dim PointsNumber as integer
Dim i as Integer
Dim InputStr as String
oDoc = ThisComponent
If IsNull(oDoc) Then
Exit Sub
EndIf
PolyPolygonShape = MyGetCurrentlySelectedSingleShape(oDoc, False)
If IsNull(PolyPolygonShape) then
exit sub
End if
PointsNumber = UBound(PolyPolygonShape.PolyPolygon(0))
Dim Points(PointsNumber) As New com.sun.star.awt.Point
Array(Points()) = PolyPolygonShape.PolyPolygon
For i= 0 to PointsNumber
Margin = oDoc.getDrawPages().getByIndex(0).BorderLeft
InputStr = ""
Value = PolyPolygonShape.PolyPolygon(0)(i).x - Margin
InputStr = InputBox ("X coordinate of the Point Nr: "&str(i)&" [mm]", "Please type in:", format(Value/100,"0.##"), 3000, 2000)
If InputStr<>"" then Value = int(100*CDbl(InputStr))
Points(i).x = Value + Margin
Margin = oDoc.getDrawPages().getByIndex(0).BorderTop
InputStr = ""
Value = PolyPolygonShape.PolyPolygon(0)(i).y - Margin
InputStr = InputBox ("Y coordinate of the Point Nr: "&str(i)&" [mm]", "Please type in:", format(Value/100,"0.##"), 3000, 2000)
If InputStr<>"" then Value = int(100*CDbl(InputStr))
Points(i).y = Value + Margin
next i
PolyPolygonShape.PolyPolygon = Array(Points())
End sub
'___________________________________________________________________________________________________________________
'**************************************************************************************
' Next functions based on Danny B's macro collection downloaded from the old oooForum.
' a version of the original code is available from this topic of the AOO forum:
' https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=15217&start=0
' and on this place:
' http://nab.pcug.org.au/20090204_bas_source/dannyb.bas
'**************************************************************************************
Function MyDrawingGetSelection(ByVal oDrawDocCtrl as object) as object
Dim oSelectedShapes as object
Dim oDrawDocCtrl2 as object
If Not HasUnoInterfaces( oDrawDocCtrl, "com.sun.star.frame.XController" ) Then
'xray oDrawDocCtrl
oDrawDocCtrl2 = MyGetDocumentController( oDrawDocCtrl )
else
oDrawDocCtrl2 = oDrawDocCtrl
EndIf
If IsEmpty( oDrawDocCtrl2.getSelection() ) Then
oSelectedShapes = createUnoService( "com.sun.star.drawing.ShapeCollection" )
else
oSelectedShapes = oDrawDocCtrl2.getSelection()
EndIf
MyDrawingGetSelection() = oSelectedShapes
End Function
'___________________________________________________________________________________________________________________
Function MyGetCurrentlySelectedSingleShape(ByVal oDrawDoc, Optional bSilent ) As Object
Dim oSelectedShapes as object
Dim oSingleSelectedShape as object
If IsMissing( bSilent ) Then
bSilent = False
EndIf
oSelectedShapes = MyDrawingGetSelection(oDrawDoc)
If oSelectedShapes.getCount() <= 0 Then
If Not bSilent Then
MsgBox( "There is not object selected" )
Exit Function
EndIf
ElseIf oSelectedShapes.getCount() > 1 Then
If Not bSilent Then
MsgBox( "Please select one shape only" )
Exit Function
EndIf
Else
oSingleSelectedShape = oSelectedShapes.getByIndex(0)
myGetCurrentlySelectedSingleShape() = oSingleSelectedShape
EndIf
End Function
'___________________________________________________________________________________________________________________
Function MyGetDocumentController( oDoc As Object ) As Object
Dim oCtrl As Object
If oDoc.supportsService( "com.sun.star.document.OfficeDocument" ) Then
oCtrl = oDoc.getCurrentController()
ElseIf HasUnoInterfaces( oDoc, "com.sun.star.frame.XController" ) Then
oCtrl = oDoc
ElseIf HasUnoInterfaces( oDoc, "com.sun.star.frame.XFrame" ) Then
oFrame = oDoc
oCtrl = oFrame.getController()
Else
MsgBox( "GetDocController called with incorrect parameter." )
EndIf
MyGetDocumentController() = oCtrl
End Function
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.