Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PressureLabelStyleCollection errors...under certain conditions?

1 REPLY 1
SOLVED
Reply
Message 1 of 2
Jeff_M
285 Views, 1 Reply

PressureLabelStyleCollection errors...under certain conditions?

I have a large solution, a portion of which is created using a WPF project. In that WPF project is a module in which we create a ViewModel to display all of the styles in a drawing. This has worked flawlessly for the last 5+ years. I am now attempting, again, to add the Pressure Networks styles. The Parts added fine, the label styles for parts, however, are throwing the following error: Get Count failed. Here's an image taken during Debugging when it gets to the Fitting Label styles:

1-24-2015 2-19-36 PM.png

 

I believe that it successfully has already accessed the Appurtenance label styles at this point, as I call them in succession. The crazy thing is, the following sample works correctly in it's own project:

 

        [CommandMethod("PipeStylesTest")]
        public void pipestylestest()
        {
            var appRoot = CivilApplication.ActiveDocument.Styles.LabelStyles.GetPressureAppurtenanceLabelStyles();
            var fitRoot = CivilApplication.ActiveDocument.Styles.LabelStyles.GetPressureFittingLabelStyles();
            var pipeRoot = CivilApplication.ActiveDocument.Styles.LabelStyles.GetPressurePipeLabelStyles();
            testit(appRoot.LabelStyles);
            testit(fitRoot.LabelStyles);
            testit(pipeRoot.LabelStyles);
        }

        private void testit (LabelStyleCollection styles)
        {
            foreach (AcDb.ObjectId id in styles)
            {
                LabelStyle style = (LabelStyle)id.Open(AcDb.OpenMode.ForRead);
                style.Close();
            }
        }

 This nearly identical to how the code in the WPF project is written. Any ideas as to why this would work in the small example, but fail everytime in the WPF project would be greatly appreciated.

Jeff_M, also a frequent Swamper
EESignature
1 REPLY 1
Message 2 of 2
augusto.goncalves
in reply to: Jeff_M

For this case, please don’t take LabelStylesRoot as a input parameter. 

Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


 

Autodesk Design & Make Report