Skip to main content
Question

How do I create an arc using a bulge value at runtime?


Forum|alt.badge.img
Hi,

 

I need to create a polyline. Some parts of the polyline are arcs.

 

 

I know I can use the Creator transformer to set start- and endpoint and the bulge parameter. But I am reading the paramters from a database at runtime so I need to be able to set the values in the Creator at runtime.

 

 

I also tried the 2DArcReplacer but there isn't a bulge parameter. So I will have to calculate the points instead. (I can do that but I was hoping to awoid that.)

 

 

Regards

 

/Tim

5 replies

sigtill
Supporter
Forum|alt.badge.img+24
  • Supporter
  • June 28, 2013
Can you use 2 workspaces?

 

Workspace1 - reading the parameters from the database and sending to Workspace2 using either WorkspaceRunner or FMEServerWorkspaceRunner 

Forum|alt.badge.img
  • Author
  • June 28, 2013
Yes. But I have more than one polyline, I don't know how many.

takashi
Influencer
  • June 28, 2013
Hi Tim,

 

 

Unfortunately, there may not be a transformer that creates an arc from two end points and the bulge. But the FME Objects Python API provides the functionality to do that, so using the PythonCaller could be a solution. Assuming that each input feature has two coordinates (i.e. start and end points) and a bulge as its attributes (named x0, y0, x1, y1, bulge), the PythonCaller with the following script replaces the input feature with an arc feature, for example:

 

-----

 

import fmeobjects   class ArcReplacer(object):     def __init__(self):         pass       def input(self, feature):         # Get start (x0, y0), end (x1, y1) and bulge values         # from the input feature.         x0 = float(feature.getAttribute('x0'))         y0 = float(feature.getAttribute('y0'))         x1 = float(feature.getAttribute('x1'))         y1 = float(feature.getAttribute('y1'))         bulge = float(feature.getAttribute('bulge'))                  # Create start and end points.         p0 = fmeobjects.FMEPoint(x0, y0, 0)         p1 = fmeobjects.FMEPoint(x1, y1, 0)                  # Create an arc geometry object.         arc = fmeobjects.FMEArc((p0, p1), bulge)                  # Create new feature having the arc and output it.          newFeature = feature.cloneAttributes()         newFeature.setGeometry(arc)         self.pyoutput(newFeature)              def close(self):         pass

 

-----

 

 

Takashi

 


takashi
Influencer
  • June 28, 2013
P.S. You can replace the last 3 lines of the input method with the next 2 lines. This probably is more efficient. -----         # Set the arc geometry to the input feature.         feature.setGeometry(arc)         self.pyoutput(feature) -----

 

 

Takashi

 


Forum|alt.badge.img
  • Author
  • July 1, 2013
Thanks, I will try the pythoncaller.

 

/Tim

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings