# Point layer draws very slowly after using ArcPy to add to mxd?

I am using an ArcPy script to add a point feature class to an mxd. The map document will draw this layer very slowly, approximately 50 to 100 points per second. If I remove the layer and add it manually, it draws about 20 times faster. the code I use is:

FeatureClass = "path\to\my\fc.gdb\featureclass"
layer = arcpy.mapping.Layer("FeatureClass")


I use this same code to add a polygon layer and it draws just fine. I've tried using this method in an unrelated mxd with an unrelated layer and it drew fine. I've also tried different symbologies, including the Arc standard, and running this on different computers with the same result.

• It could be something with a specific mxd. Can you reproduce this by opening up a blank mxd and executing that same code? – crmackey Feb 9 '17 at 14:29
• My coworkers and I use this script about 10 times a day, on 3 different computers. I've run it both on my local machine and over our in house server, with the same result every time. And just to be clear, that is with quite a few different mxd's. – Craig T Feb 9 '17 at 14:31
• Gotcha, I think I just spotted what was slowing it down. See my answer below. – crmackey Feb 9 '17 at 14:36
• If your feature class varies in record count by that much regularly, it could be an index problem or could be the gdb just needs a compress. Both of these could be added separately into your script to test – Midavalo Feb 11 '17 at 21:22
• @CraigT Please edit your question to include extra information and responses, rather than as comments. Potential answerers don't always see all the comments - all relevant info should be in your question. – Midavalo Feb 11 '17 at 21:28

You actually do not have to use arcpy.MakeFeatureLayer_management() first, you can just create an arcpy.mapping.Layer from the feature class itself:
FeatureClass = "path\to\my\fc.gdb\featureclass"