Hello,
Exactely what I need...Yes, I am displaying sectors.
I the meantime, I wrote this... Basically it creates 2 lines and an arc... but the script takes quite a long time to run.
It also needs to have 3 points I am processing via SQL.
I reckon your way is much more efficient.
Thanks a lot for your help.
'***************************
'Sub Procedure:CreateLineArc
'***************************
Sub CreateLineArc
Dim Obj1 as Object 'Line
Dim Obj2 as Object 'Arc
Dim Obj3 as Object 'Line
Dim Obj4 as Object 'Combined Objects
Dim start_angle, end_angle as Float
Dim i as integer
i=0
Fetch First From test_cut
While Not EOT (test_cut)
i=i+1
'print test_cut.actual_longitude
'print i
Create Line into Variable Obj1 ( test_cut.actual_longitude, test_cut.actual_latitude) ( test_cut.Longitude2a, test_cut.Latitude2a)
'Create Arc into Variable Obj2 ( test_cut.Longitude2a, test_cut.Latitude2a) ( test_cut.Longitude2b, test_cut.Latitude2b) 90 30
Obj2 = Exec("MapCAD.mbx","ArcFromPointsXY", test_cut.Longitude2a, test_cut.Latitude2a, test_cut.Longitude2, test_cut.Latitude2, test_cut.Longitude2b, test_cut.Latitude2b)
Create Line into Variable Obj3 ( test_cut.actual_longitude, test_cut.actual_latitude) ( test_cut.Longitude2b, test_cut.Latitude2b)
Obj4 = Combine (Combine( Obj1, Obj2) , Obj3)
'Obj4 = Combine ( Obj1,Obj3)
Update test_cut set obj = Obj4 where Rowid = i
Fetch Next From test_cut
wend
end sub
------------------------------
Alban Spella-Barberet
NBN Co Limited
North Sydney NSW
------------------------------
Original Message:
Sent: 09-15-2022 02:14
From: Peter Møller
Subject: Trying to draw a shape being line, arc, line
Hi Alban
It seems you are trying to create a sector.
Does your arc really have to be an arc, or could it be a polyline with "many" points describing an arc?
Some years back I described how you can create a function that would create an Annulus Sector:
A Sector is created from a circle whereas an annulus Sector is created from a doughnut.
Four examples of annulus sectors - the top right is a sector - it starts at the center of the circle.
All four have been created with the function below.
If you pass a value of 0 for the fInnerRadius
the function below will return a Sector.
Function CreateAnnulusSector( ByVal oCenterPoint As Object
, ByVal fInnerRadius As Float 'in meters
, ByVal fOuterRadius As Float 'in meters
, ByVal fStartAngle As Float
, ByVal fEndAngle As Float
, ByVal nResolution As Integer
) As Object
Dim oSector, oCutter As Object,
fAngle, fRotatedAngle, fX, fY, fDistance As Float,
i As Integer
CreateAnnulusSector = oCenterPoint
'**Create concentric circle
oSector = CartesianBuffer(oCenterPoint, nResolution, fOuterRadius, "m")
If fInnerRadius > 0 Then
oSector = Erase(oSector, CartesianBuffer(oCenterPoint, nResolution, fInnerRadius, "m"))
End If
'**Find center coordinates
fX = CentroidX(oCenterPoint)
fY = CentroidY(oCenterPoint)
'**Calculate distance for cutter object
fDistance = 3 * fOuterRadius
Create Pline Into Variable oCutter
1 (fX, fY)
Alter Object oCutter
Node Add ( fX + ((Cos(fStartAngle * DEG_2_RAD)) * fDistance)
, fY + ((Sin(fStartAngle * DEG_2_RAD)) * fDistance))
Alter Object oCutter
Node Add ( fX + ((Cos(fEndAngle * DEG_2_RAD)) * fDistance)
, fY + ((Sin(fEndAngle * DEG_2_RAD)) * fDistance))
'**Convert cutter polyline to a polygon
oCutter = ConvertToRegion(oCutter)
'**Erase the concentric circle where the cutter object doesn't overlap
oSector = Overlap(oSector, oCutter)
CreateAnnulusSector = oSector
End Function
I have also attached an mb file with the function and an example of how you can use the function. You can run the application in MapInfo Pro with a map window open. The annulus sectors will be created based on the center of the map and the zoom of the map.
------------------------------
Peter Horsbøll Møller
Principal Presales Consultant | Distinguished Engineer
Precisely | Trust in Data
Original Message:
Sent: 09-14-2022 21:55
From: Alban Spella-Barberet
Subject: Trying to draw a shape being line, arc, line
Hello,
I have 3 points.
Point #1, point #2 and point #3

I am trying to draw a line from point #1 to point#2 (create line) then an arc from point #2 to point #3 (create arc), then line from point #3 to point #1 (create line).
When I use update set obj = createline, it will wipe off the previous drawing.
So, is there a command to do this please?
Thanks
------------------------------
Alban Spella-Barberet
NBN Co Limited
North Sydney NSW
------------------------------