Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This really seems like I should be able to do this, but I am running into some problems. I want to import 3D Analyst with python, in the same way I import Spatial Analyst, but it returns an error.

For Spatial Analyst I use the following:

from arcpy.sa import *

This allows me to use the spatial analyst functions in python scripts outside of ArcMap. I want to do the same with 3D analyst, but I am running into an error.

I really feel like it should just be:

from arcpy.3D import *

I also tried arcpy.3d, but either way I get the error:

Parsing error <type 'exceptions.SyntaxError'>: invalid syntax (line 1)

Any help would be most appreciated, thanks in advance.

share|improve this question
    
I know that I can use a 3D Analyst tool with say: arcpy.aspect_3d(), but I am mainly wondering if I can import the 3D Analyst library the same way. – Cody Brown Aug 23 '12 at 17:36
3  
Spatial Analyst is a module within arcpy which allows the from ___ import * syntax. 3D is not a module so you can't import it that way. – twospeeder Aug 23 '12 at 18:10
    
Thanks for the info @twospeeder I was just starting to think the same thing. – Cody Brown Aug 23 '12 at 18:15
1  
@twospeeder - You should post that as an official answer so that it is searchable by other people with potentially the same question. – Get Spatial Aug 23 '12 at 18:25
    
Done. Thanks for the tip. – twospeeder Aug 23 '12 at 19:43
up vote 2 down vote accepted

Spatial Analyst is a module within arcpy which allows the from _ import * syntax. 3D is not a module so you can't import it that way.

share|improve this answer

Sorry for bumping this old question, but a Python module's name cannot begin with a number, so arcpy.3d will never work. To import the module, you'll need to reference ddd:

from arcpy.ddd import *

or:

from arcpy import ddd

A geoprocessing tool can be referenced in arcpy by either arcpy._ or arcpy... For 3D Analyst, the toolbox alias is '3d' but the module name is 'ddd'.

share|improve this answer
    
Thank you for adding an answer that is correct. It's a little sad that a patently, demonstrably false answer was accepted as correct on this question. – Jason Scheirer Mar 10 at 2:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.