Hot News:

Mit Unterstützung durch:

  Foren auf CAD.de (alle Foren)
  SIMULIA/ABAQUS
  Keyword error on faces when handing over tuples to f.findAt function

Antwort erstellen  Neues Thema erstellen
CAD.de Login | Logout | Profil | Profil bearbeiten | Registrieren | Voreinstellungen | Hilfe | Suchen

Anzeige:

Darstellung des Themas zum Ausdrucken. Bitte dann die Druckfunktion des Browsers verwenden. | Suche nach Beiträgen nächster neuer Beitrag | nächster älterer Beitrag
Autor Thema:  Keyword error on faces when handing over tuples to f.findAt function (1335 / mal gelesen)
Bernd2019
Mitglied
none

Sehen Sie sich das Profil von Bernd2019 an!   Senden Sie eine Private Message an Bernd2019  Schreiben Sie einen Gästebucheintrag für Bernd2019

Beiträge: 3
Registriert: 28.10.2019

this did the job, thank you!

erstellt am: 28. Okt. 2019 22:42    Editieren oder löschen Sie diesen Beitrag!  <-- editieren / zitieren -->   Antwort mit Zitat in Fett Antwort mit kursivem Zitat    Unities abgeben: 1 Unity (wenig hilfreich, aber dennoch)2 Unities3 Unities4 Unities5 Unities6 Unities7 Unities8 Unities9 Unities10 Unities


10SinglePartwithintersectionsmetalcoatingset.txt

 
I want to make a set with the help of some python code. The coordinates for the set are stored in the list circle list.

The following I tried:


Code:
p = mdb.models['Model-1'].parts['Part-1']
f = p.faces

coordinates_for_faces = tuple()

for i in range(0, len(circleList)):
    tuple_coordinates= (circleList[i].center.x, circleList[i].center.y,0.0)
    coordinates_for_faces = coordinates_for_faces + tuple_coordinates

print("coordinates_for_faces:",  coordinates_for_faces)
faces = f.findAt(*coordinates_for_faces)
p.Set(faces=faces, name='SetOfFibers')


So I stored the coordinates in a tupel. In faces I tried to reference these tupels.

This brings the error "Keyword error on faces" while running the code in python.

I also tried to make a list of tupels and hand over that list of tupels. Attached is the whole code.

Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP

Mustaine
Ehrenmitglied V.I.P. h.c.



Sehen Sie sich das Profil von Mustaine an!   Senden Sie eine Private Message an Mustaine  Schreiben Sie einen Gästebucheintrag für Mustaine

Beiträge: 3554
Registriert: 04.08.2005

Abaqus

erstellt am: 29. Okt. 2019 09:49    Editieren oder löschen Sie diesen Beitrag!  <-- editieren / zitieren -->   Antwort mit Zitat in Fett Antwort mit kursivem Zitat    Unities abgeben: 1 Unity (wenig hilfreich, aber dennoch)2 Unities3 Unities4 Unities5 Unities6 Unities7 Unities8 Unities9 Unities10 Unities Nur für Bernd2019 10 Unities + Antwort hilfreich

I've run your script and it throws several error unrelated to your question. First the name of a function is not matching, then the number of arguments doesn't fit. I've fixed both, but then a problem with a variable and it's namespace appeared.

Maybe you create a simple example that focuses on the question.

Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP

Mefh
Mitglied



Sehen Sie sich das Profil von Mefh an!   Senden Sie eine Private Message an Mefh  Schreiben Sie einen Gästebucheintrag für Mefh

Beiträge: 45
Registriert: 04.03.2015

erstellt am: 29. Okt. 2019 13:02    Editieren oder löschen Sie diesen Beitrag!  <-- editieren / zitieren -->   Antwort mit Zitat in Fett Antwort mit kursivem Zitat    Unities abgeben: 1 Unity (wenig hilfreich, aber dennoch)2 Unities3 Unities4 Unities5 Unities6 Unities7 Unities8 Unities9 Unities10 Unities Nur für Bernd2019 10 Unities + Antwort hilfreich

You try to create a sequence of coordinates and therefrom a sequence of faces. I believe this will not work.
Better is to create a face from a coordinate and therefrom a sequence of faces. in your case:

    faces = []
    for i in range(0, len(circleList)):
        tuple_coordinates = ((circleList[i].center.x, circleList[i].center.y,0.0),)
        face = f.findAt( tuple_coordinates)
        fi =  face[0].index
        faces.append( f[fi:fi+1])

    p.Set(faces=faces, name='SetOfFibers')

[Diese Nachricht wurde von Mefh am 29. Okt. 2019 editiert.]

Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP

Bernd2019
Mitglied
none

Sehen Sie sich das Profil von Bernd2019 an!   Senden Sie eine Private Message an Bernd2019  Schreiben Sie einen Gästebucheintrag für Bernd2019

Beiträge: 3
Registriert: 28.10.2019

this did the job, thank you!

erstellt am: 29. Okt. 2019 14:51    Editieren oder löschen Sie diesen Beitrag!  <-- editieren / zitieren -->   Antwort mit Zitat in Fett Antwort mit kursivem Zitat    Unities abgeben: 1 Unity (wenig hilfreich, aber dennoch)2 Unities3 Unities4 Unities5 Unities6 Unities7 Unities8 Unities9 Unities10 Unities


10bsimplificationforforum.txt

 
Zitat:
Original erstellt von Mustaine:
I've run your script and it throws several error unrelated to your question. First the name of a function is not matching, then the number of arguments doesn't fit. I've fixed both, but then a problem with a variable and it's namespace appeared.

Maybe you create a simple example that focuses on the question.


I simplified it a bit. No I have a rectangular part with a rectangular inclusion.
My function "MakeSet" should make a set of both rectangles.

Problem: The function only makes a set of one of the two rectangles.
When I change the  range(0,2) to range(1,2), it makes a set of the larger rectangle without the inclusion.

The final aim is to build a function which makes a set of round inclusions (~50 of them) in a rectangle.

def MakeSet(circleList):

    p = mdb.models['Model-1'].parts['Part-1']
    f = p.faces

    list_x = (1,-1,0)
    list_y = (1,-1,0)

    coordinates_for_faces = tuple()
    tuple_coordinates = tuple()

    for i in range(0,2):
        tuple_coordinates = ((list_x[i], list_y[i], 0.0),)
        coordinates_for_faces = coordinates_for_faces + tuple_coordinates

    print("coordinates_for_faces", coordinates_for_faces)
    faces = f.findAt(coordinates_for_faces)
    p.Set(faces=faces, name='SetOfFibers')

Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP

Bernd2019
Mitglied
none

Sehen Sie sich das Profil von Bernd2019 an!   Senden Sie eine Private Message an Bernd2019  Schreiben Sie einen Gästebucheintrag für Bernd2019

Beiträge: 3
Registriert: 28.10.2019

this did the job, thank you!

erstellt am: 29. Okt. 2019 15:14    Editieren oder löschen Sie diesen Beitrag!  <-- editieren / zitieren -->   Antwort mit Zitat in Fett Antwort mit kursivem Zitat    Unities abgeben: 1 Unity (wenig hilfreich, aber dennoch)2 Unities3 Unities4 Unities5 Unities6 Unities7 Unities8 Unities9 Unities10 Unities

Zitat:
Original erstellt von Mefh:
You try to create a sequence of coordinates and therefrom a sequence of faces. I believe this will not work.
Better is to create a face from a coordinate and therefrom a sequence of faces. in your case:

    faces = []
    for i in range(0, len(circleList)):
        tuple_coordinates = ((circleList[i].center.x, circleList[i].center.y,0.0),)
        face = f.findAt( tuple_coordinates)
        fi =  face[0].index
        faces.append( f[fi:fi+1])

    p.Set(faces=faces, name='SetOfFibers')


[Diese Nachricht wurde von Mefh am 29. Okt. 2019 editiert.]


Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP

Anzeige.:

Anzeige: (Infos zum Werbeplatz >>)

Darstellung des Themas zum Ausdrucken. Bitte dann die Druckfunktion des Browsers verwenden. | Suche nach Beiträgen

nächster neuerer Beitrag | nächster älterer Beitrag
Antwort erstellen


Diesen Beitrag mit Lesezeichen versehen ... | Nach anderen Beiträgen suchen | CAD.de-Newsletter

Administrative Optionen: Beitrag schliessen | Archivieren/Bewegen | Beitrag melden!

Fragen und Anregungen: Kritik-Forum | Neues aus der Community: Community-Forum

(c)2023 CAD.de | Impressum | Datenschutz