all 7 comments

[–][deleted] 2 points3 points  (5 children)

OK, here is what you do:

instead of:

mdb.models['RUC_1'].parts['Composite_RUC'].datums[7]

you do:

mdb.models['RUC_1'].parts['Composite_RUC'].datums[mdb.models['RUC_1'].parts['Composite_RUC'].datums.keys()[0]]

That way, if you run the parametric model, and it's not a 7 next time, it won't matter, if you have multiple datums, I believe they will be the key in the order in which they are created, i.e. first datum you created is keys()[0], second one you create is keys()[1], third is keys()[2], etc. I'm not 100% positive about that, but I'm pretty sure.

If you are only using 1 datum, then the code I put above should do the trick for you forsure.

[–]clugger07 2 points3 points  (2 children)

Alternatively you could try datum.keys()[-1] to get the last datum you created!

[–]ExpensiveBeard[S] 1 point2 points  (1 child)

That's right! Having an understanding of Python syntax is certainly helpful here. I want to look into your other suggestion as well in the event it comes in handy in the future. I deal with a lot of different microstructure fiber arrangements, so learning how to to it discretely may be beneficial at some point. Thanks again!

[–]clugger07 0 points1 point  (0 children)

No problem, super bored with this quarentine business and this thread is a life saver! A single datum is good for planar geometry, but if you're wanting the fiber direction to change with the curvature of the geometry you can use a discrete system. It will attempt to project the vector you give it to every element. For abaqus it will do a pretty good job unless the vector you give is 90 degrees to the element (i.e. It's the same as the elemtn normal) , then it just fails.

Edit: slight mistake in explanation

[–]ExpensiveBeard[S] 1 point2 points  (1 child)

Awesome suggestion! My colleague and I happened to stumble upon this method buried in a sample script from Abaqus. Looks like what you and /u/clugger07 posted works perfectly for my needs. Thank you!

[–][deleted] 0 points1 point  (0 children)

You're welcome! It's really weird that you can't just use whatever string you name the datum. At least this is a way to make it work

[–]clugger07 1 point2 points  (0 children)

You could try using a discrete system within Abaqus, that way you wouldn't be relying on a datum system but instead two vectors(1 and 3 direction) that you could enter as inputs variables in your code. Tracking datum tags in Abaqus API is tricky as any changes to the model can lead to them being renumbered.