There are several situations in the Catholic Church which result in automatic excommunication.
These are the sins which cause automatic excommunication in the Catholic Church. These are clarified in the 1983 Code of Canon Law.
These apostasy, heresy, schism (CIC 1364:1), violating the sacred species (CIC 1367), physically attacking the pope (CIC 1370:1), absolving an accomplice in a sexual sin (CIC 1378:1), consecrating a bishop without authorization (CIC 1382), and directly violating the seal of confession (1388:1)
Automatic excommunication for abortion (CIC 1398 and Evangelium Vitae 62) applies not only to the woman who has the abortion, but to "all those who commit this crime with knowledge of the penalty attached, and includes those accomplices without whose help the crime would not have been committed". Canon 1329 is applied. That is the point. The more severe, the most narrow the application is the rule for Canon Law.
Canon Law 1329.1 refers to direct, immediate and grave.
Also included is membership to the Masons and receiving Holy Communion while in an irregular marriage.
Automatic excommunication is called latae sententiae.
One does not need to understand what this means to be automatically excommunicated, as these are such grave evils. There are two types of knowledge.
Formal and material knowledge are these two types of knowledge. Natural law covers formal knowledge for any person over the age of 13.
One does not have to know it is an act which makes one an excommunicate, but only have to know it is really bad, like abortion for those brought up Catholics.
Material knowledge has to do with precepts within the law. One cannot attend a Mass where only the host is consecrated, for example and not the wine, which is a serious sin and an extension of natural law. Hitting a pope comes under material knowledge, which means one has to know it is an extension of natural law.
Not so with abortion, which is so evil, one would know how serious this is.
If one is a Mason and has gone through some of the ceremonies, one is excommunicated. This would occurs about the fourth level, which equal automatic excommunication.
Some Canons are Church laws, and some are God's laws. God's laws is where one could not ever say "I did not know", such as with abortion. One is culpable for breaking God's laws.
Blasphemy, adultery, abortion, judicial murder, bestiality and so on NO EXCUSE. Arbitrary justice, (lynch mobs, Star Chamber and so on ), is also a serious sin which a person cannot excuse themselves.
See the difference?