POST
|
Hi Jeff, That's brilliant news. Would be great to test it out in Alpha/Beta if possible. Adam
... View more
09-18-2020
03:41 PM
|
0
|
0
|
776
|
POST
|
Hi, I can do this manually but is there an easier way? Can either Container or Parent be made Public please? public static GroupElement FindElementGroup(this Layout layout, Element elementToFind)
{
foreach (GroupElement groupElement in layout.GetNestedElements().OfType<GroupElement>().ToList())
{
if (groupElement.Elements.Any(element => element.Name.Equals(elementToFind.Name)))
{
return groupElement;
}
}
return null;
}
public static List<Element> GetNestedElements(this ILayoutElementContainer elementContainer)
{
List<Element> elements = elementContainer.Elements.ToList();
foreach (GroupElement groupElement in elementContainer.Elements.OfType<GroupElement>())
{
elements.AddRange(groupElement.GetNestedElements());
}
return elements;
} Adam
... View more
07-17-2020
05:04 AM
|
0
|
1
|
416
|
POST
|
Hi Jeff, I can concur there are some serious performance issues with adding Graphics Elements in 2.5 when other tabs are open. We have a slightly different situation but it's essentially the same result. Our add-in does some map frame cloning and adding quite a few graphic elements on a number of layouts. If we have ANY layout open (not just the ones we are working on) then our code finishes (not quickly but it does finish) but Pro then goes into a unresponsive state for up to 4 hours (around 20 layouts). If we close all layouts programatically before we start then it only hangs for around 15 minutes. It think it also may be related to your post on 11 May with bulk adding of GraphicElements and Uma's bulk creation overloads where i would imagine they are disconnecting UI updates for the duration of the bulk addition. What would be more useful would be a way to programatically turn UI updates off for the duration of a Task and only have UI update at the end. Adam
... View more
07-13-2020
02:35 AM
|
0
|
0
|
439
|
POST
|
Hi Tom, Thanks for the detailed reply but it's not addressing the issue. What we are looking for is a set of grid properties that give a sensible looking output at any rotation angle. So we don't waste too much whitespace around the dataframe we want all text to sit "tight" to the dataframe. So we are more concerned with the orientation of the text in relation to the piece of paper rather than the grid itself. We want to be able to set it up once and then whatever angle of dataframe it should do that. Imagine hundreds of pipeline/cable strip charts. This is at 266 (-94 in Esri parlance) - all looks good. Set it to 0 degrees and it looks terrible. In certain angles where a line hits 2 sides of the dataframe then there is no way to easily get the right output (you could make 2 grids but that's a lot of work). South with vertical on/off and never looks OK. We are a company that has a software product that automates the production of these alignments sheets in Desktop/Pro. If there is no option for this in Pro we will have to code to back calculate which side the text is on and align it appropriately (and in certain situations clone the grids and reverse the properties to allow for the above). Not a huge problem but a shame to have to do it. As others have mentioned ArcGIS Desktop does this natively. Thanks, Adam
... View more
05-22-2020
05:25 AM
|
0
|
4
|
1797
|
POST
|
Hi, I want to revisit the requirement NOT to be in a QueuedTask to show a Dialog such as OpenItemDialog, SaveItemDialog and the CoordinateSystemPicker example. When in a QueuedTask the dialogs spin endlessly. I would like Esri to rethink this restriction. As an experiment we implemented a basic Coordinate System Picker that works in all conditions. The Esri dialog spins endlessly whilst waiting for the coordinate list to show. The line of code that creates a list of inbuilt Coordinate Systems is IReadOnlyList<CoordinateSystemListEntry> coordinateSystemListEntries = GeometryEngine.Instance.GetPredefinedCoordinateSystemList( CoordinateSystemFilter.GeographicCoordinateSystem | CoordinateSystemFilter.ProjectedCoordinateSystem); This function is not restricted on which thread it runs so I am unclear as to why the Esri Coordinate System Picker hangs. https://pro.arcgis.com/en/pro-app/sdk/api-reference/index.html#topic15554.html Please rethink the internal design of these dialogs so that we can use them without restrictions. Thanks, Adam
... View more
05-08-2020
02:20 AM
|
0
|
0
|
499
|
POST
|
Hi Charles, Thanks for the code. I tried that and no difference - the first time the button is used entering a filegdb gives an infinitely scrolling wait icon. The 2nd time the button is used it shows the contents immediately. it would be great if this could be made to work within the API whilst in QueuedTask.Run(). The realities of a very large code base don't always allow for being able to nip on/off the MCT at will. We have a code base that is entirely synchronous and are so are pragmatically wrapping our entire command in a single QueuedTask.Run(). Thanks, Adam
... View more
03-09-2020
09:30 AM
|
0
|
0
|
506
|
POST
|
Hi, At 2.5 still having issues getting dialogs to show correctly when used from within QueuedTask.Run. The Coordinate System Dialog is the one from the snippet collection This works from a button protected override void OnClick() { new SaveItemDialog().ShowDialog(); new CoordinateSystemDialog().ShowDialog(); } So does this protected override void OnClick() { FrameworkApplication.Current.Dispatcher.Invoke(() => new SaveItemDialog().ShowDialog()); FrameworkApplication.Current.Dispatcher.Invoke(() => { new CoordinateSystemDialog().ShowDialog(); }); } But this does not. protected override void OnClick() { QueuedTask.Run( () => { FrameworkApplication.Current.Dispatcher.Invoke(() => new SaveItemDialog().ShowDialog()); FrameworkApplication.Current.Dispatcher.Invoke(() => { new CoordinateSystemDialog().ShowDialog(); }); }); } The coordinate system dialog never completes loading. The Open/Save Dialogs do not show the contents of a fgdb. If I run the command again in the same session then the Open/Save Dialogs show the contents of a fgdb Is there a workaround whilst it's being fixed? Thanks, Adam
... View more
03-03-2020
07:24 AM
|
0
|
2
|
714
|
POST
|
Hi, Cloning Layout using the code supplied by Esri no longer work in 2.5 - see question below Duplicate existing layout - ArcGIS Pro SDK In the UI the layout is cloned but not renamed; the page size is lost. All the elements are shown but they don't exist! The element list in the cloned layout is empty. The elements can be selected but their properties cannot be shown. In code the layout exists but it does not have any elements. If the aprx is saved; closed and then reopened then actually the clone is OK. Is there a workaround to get the clone to update correctly? Adam
... View more
02-28-2020
09:27 AM
|
0
|
2
|
529
|
POST
|
Hi Jeff, I do think the addition of elements needs changing. The current way seems to be create the element and then change the properties. Even if the element is added to a group then the element is created at the root level and then moved. It can be seen doing that in the Pro TOC. When making a lot of these in multiple layout Pro has to do a lot of individual TOC/UI updating which makes Pro become unresponsive for a long time. So, it would be good if the SDK team could look both at 1) Improving the efficiency of creating elements (putting elements directly into the correct group and adding the name property to the Factory creation functions) 2) Being able to suspend Pro Window update; do a bunch of stuff and then turn it back on and refresh current layout. In the long term it would be ideal if we could access and modify project files (aprx) without having them open in Pro (like we can with mxds in in Desktop). Adam
... View more
02-28-2020
09:18 AM
|
0
|
0
|
776
|
POST
|
Hi Jeff, Great to hear. I did actually manage to find a magic combination that gets it to work but it was hours of trial and error. It was to use SetName and then change another property using get/set definition. Adam
... View more
02-28-2020
09:06 AM
|
0
|
0
|
466
|
POST
|
Creating a group with a list of Elements works OK. If the group's name is changed then all the elements disappear into thin air. Layout layout = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault()?.GetLayout();
List<Element> elements = new List<Element>();
for (int i = 0; i < 100; i++)
{
List<Coordinate2D> lineCoordinates = new List<Coordinate2D> { new Coordinate2D { X = i, Y = 0 }, new Coordinate2D { X = i, Y = 100 } };
Polyline polylineTic = PolylineBuilder.CreatePolyline(lineCoordinates);
CIMLineSymbol lineSym = SymbolFactory.Instance.ConstructLineSymbol(ColorFactory.Instance.BlackRGB, 1.0, SimpleLineStyle.Solid);
GraphicElement lineElm = LayoutElementFactory.Instance.CreateLineGraphicElement(layout, polylineTic, lineSym);
CIMElement cimElement = lineElm.GetDefinition();
cimElement.Name = "Line" + i;
lineElm.SetDefinition(cimElement);
elements.Add(lineElm);
}
GroupElement groupElement = LayoutElementFactory.Instance.CreateGroupElement(layout, elements);
CIMElement cimGroupElement = groupElement.GetDefinition();
cimGroupElement.Name = "First Level Group";
groupElement.SetDefinition(cimGroupElement); Adam
... View more
02-07-2020
12:27 PM
|
0
|
2
|
522
|
POST
|
The more levels of group an element is put in the slower it is. 100 lines at root level 3 seconds 100 lines at Level1 14 seconds 100 lines at Level2 19 seconds It looks like Pro makes the Element at root level and then moves it which means there's a performance hit! Is there a way of speeding this up? Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
Layout layout = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault()?.GetLayout();
GroupElement groupElement = LayoutElementFactory.Instance.CreateGroupElement(layout);
CIMElement cimGroupElement = groupElement.GetDefinition();
cimGroupElement.Name = "First Level Group";
groupElement.SetDefinition(cimGroupElement);
GroupElement groupElement2 = LayoutElementFactory.Instance.CreateGroupElement(groupElement);
for (int i = 0; i < 100; i++)
{
List<Coordinate2D> lineCoordinates = new List<Coordinate2D> { new Coordinate2D { X = i, Y = 0 }, new Coordinate2D { X = i, Y = 100 } };
Polyline polylineTic = PolylineBuilder.CreatePolyline(lineCoordinates);
CIMLineSymbol lineSym = SymbolFactory.Instance.ConstructLineSymbol(ColorFactory.Instance.BlackRGB, 1.0, SimpleLineStyle.Solid);
GraphicElement lineElm = LayoutElementFactory.Instance.CreateLineGraphicElement(groupElement2, polylineTic, lineSym);
CIMElement cimElement = lineElm.GetDefinition();
cimElement.Name = "Line" + i;
lineElm.SetDefinition(cimElement);
}
stopwatch.Stop();
Debug.Print((stopwatch.ElapsedMilliseconds / 1000).ToString()); Adam
... View more
02-07-2020
10:04 AM
|
0
|
4
|
861
|
POST
|
If I create a group at the layout level and then create elements in that group then all OK. When creating a named group within a group - elements are not correctly placed in the named group - they are placed directly on the layout instead. If I don't set the name then all OK. Layout layout = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault()?.GetLayout();
GroupElement groupElement = LayoutElementFactory.Instance.CreateGroupElement(layout);
CIMElement cimGroupElement = groupElement.GetDefinition();
cimGroupElement.Name = "First Level Group";
groupElement.SetDefinition(cimGroupElement);
GroupElement groupElement2 = LayoutElementFactory.Instance.CreateGroupElement(groupElement);
CIMElement cimGroupElement2 = groupElement2.GetDefinition();
cimGroupElement2.Name = "Second Level Group";
groupElement2.SetDefinition(cimGroupElement2);
for (int i = 0; i < 100; i++)
{
List<Coordinate2D> lineCoordinates = new List<Coordinate2D> { new Coordinate2D { X = i, Y = 0 }, new Coordinate2D { X = i, Y = 100 } };
Polyline polylineTic = PolylineBuilder.CreatePolyline(lineCoordinates);
CIMLineSymbol lineSym = SymbolFactory.Instance.ConstructLineSymbol(ColorFactory.Instance.BlackRGB, 1.0, SimpleLineStyle.Solid);
GraphicElement lineElm = LayoutElementFactory.Instance.CreateLineGraphicElement(groupElement2, polylineTic, lineSym);
CIMElement cimElement = lineElm.GetDefinition();
cimElement.Name = "Line" + i;
lineElm.SetDefinition(cimElement);
} Adam
... View more
02-07-2020
09:36 AM
|
0
|
3
|
545
|
POST
|
I can always make it crash when making and renaming a group. Make a new project. Add a layout (leave it on the layout). Layout layout = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault()?.GetLayout();
GroupElement groupElement = LayoutElementFactory.Instance.CreateGroupElement(layout);
CIMElement cimGroupElement = groupElement.GetDefinition();
cimGroupElement.Name = "First Level Group";
groupElement.SetDefinition(cimGroupElement); Adam
... View more
02-07-2020
09:25 AM
|
0
|
0
|
454
|
Title | Kudos | Posted |
---|---|---|
1 | 03-14-2024 02:06 AM | |
1 | 03-13-2024 01:19 PM | |
1 | 03-12-2024 02:56 AM | |
1 | 08-04-2021 05:01 AM | |
1 | 01-18-2022 02:10 AM |
Online Status |
Offline
|
Date Last Visited |
3 weeks ago
|