Modifying the nodes that define an element

70 views
Skip to first unread message

miguel...@gmail.com

unread,
Apr 9, 2019, 10:34:21 AM4/9/19
to pyNastran Discuss
Hi

I'm trying to modify the nodes that define an element using pyNastran, for example If I have a 'CONROD' element in my model between nodes '5' and '6':
conrod = model.elements[1]
print(cornod)

CONROD         1       5       6      10    .001      .2

how can I modify the nodes that define the rod, so the element is beteewn '5' and '7'?

If I do :

conrod.nodes_ids[1] = 7

the nodes of the element remain the same.

Thanks

Steven Doyle

unread,
Apr 9, 2019, 11:02:58 AM4/9/19
to pyNastran Discuss
I didn't realize that was that even allowed.  That's a property and accesses different data depending on if the card is cross-referenced or not.  It's for informational purposes.

If the element is cross-referenced:
conrod.nodes_ref[1].nid = 7

and if it's not:
conrod.nodes[1] = 7

--
You received this message because you are subscribed to the Google Groups "pyNastran Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pynastran-disc...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

miguel...@gmail.com

unread,
Apr 9, 2019, 11:14:52 AM4/9/19
to pyNastran Discuss
That doesn't work either, I attach a .bdf file and .py for testing.
To unsubscribe from this group and stop receiving emails from it, send an email to pynastra...@googlegroups.com.
test.bdf
test.py

Steven Doyle

unread,
Apr 9, 2019, 11:43:53 AM4/9/19
to pyNastran Discuss
You have a cross-referenced model, which is why your script doesn't work.  Cross-referencing is opt-out as an option in read_bdf.

So nominally, I'd do it like this:

from pyNastran.bdf.bdf import BDF
model = BDF()
model.read_bdf('test.bdf')
conrod = model.elements[1]
conrod.nodes_ref[1].nid = 7
model.write_bdf('test2.bdf')

but that would give you two node 7s with different locations.  I thought you were trying to remap/renumber the node while keeping connectivity the same.

To do that, you could do that with cross-referencing as:
conrod.nodes_ref[1] = model.Node(7)

or:uncross-reference it (with or without re-cross-referencing)
conrod.uncross_reference()
conrod.nodes[1] = 7
conrod.cross_reference(model)




To unsubscribe from this group and stop receiving emails from it, send an email to pynastran-disc...@googlegroups.com.

miguel...@gmail.com

unread,
Apr 10, 2019, 10:43:11 AM4/10/19
to pyNastran Discuss
Thanks, that clarified the issue
Reply all
Reply to author
Forward
0 new messages