[Tutor] IndentationError
Alan Gauld
alan.gauld at btinternet.com
Tue Aug 12 01:51:36 CEST 2014
On 11/08/14 22:28, 王学敏 wrote:
> for i in range(len(data)):
> instancename='Part'+str(i)+'-'+str(1)
> partname='Part'+str(i+1)
> pre_part='Part'+str(i)
> mdb.models['Model-1'].rootAssembly.translate(instanceList=('fiber-1', ),vector=(data[i][0], data[i][1], 0.0))
> mdb.models['Model-1'].rootAssembly.InstanceFromBooleanCut(cuttingInstances=(...
> mdb.models['Model-1'].rootAssembly.instances['fiber-1'], ), ...
> instanceToBeCut=mdb.models['Model-1'].rootAssembly.instances[instancename], ...
> name=partname, originalInstances=SUPPRESS)
> del mdb.models['Model-1'].parts['pre_part']
> mdb.models['Model-1'].rootAssembly.features['fiber-1'].resume()
Like the subject says, you have multiple indentation errors.
If you want further help I suggest you tell us what "problems"
you get - including full error messages.
Also if you can reduce your code to something more readable
that will help.
Also...
from part import *
from material import *
the import * style of import can lead to problems with
name clashes - with the last imported name masking
all others. This is doubly true when you have so as many
imports as you do, the likelihood of a name being used
twice is quite high.
Finally, I don't recognise any of the modules you are
importing, I assume they are from some specialist library
or other. In particular you seem to be referencing
something called mdb but that does not appear as a module
or variable in your code, so its impossible for us to
tell what it is. (Presumably its imported as one of
the * names but we have no clue which module it comes
from!) You could maybe try asking for help on that
library's support forum if the error proves to be
library related.
HTH
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list